Does MySQL support the bracket wildcard?

1.7k views Asked by At

I tried using the brackets wild card and nothing came up.

I'm using SequelPro (and I think that uses MySQL, though I could be wrong).

Does it support the bracket [] wildcard?

If not, what can I use in it's replacement?

Here's an example --

SELECT *
FROM actor_info
WHERE first_name LIKE '[PBD]%';

It returns nothing.

What I think it should do is give me all fields from actor_info where the first_name field starts with the characters 'P' 'B' or 'D' and have zero to any number of characters following them.

Example --

'Penelope'

'Brandon'

'D'

Whereas 'George', NULL and 'Aaron' would not match.

Thank you.

1

There are 1 answers

2
tadman On

LIKE does not support this, but RLIKE does. Downside: It's a regular expression, but if you're familiar with those then it's what you want.