4

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.

Sebastian
  • 957
  • 3
  • 15
  • 27

1 Answers1

3

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.

tadman
  • 208,517
  • 23
  • 234
  • 262
  • What is the difference between a regular expression and the expression in the example? – Sebastian Sep 09 '17 at 19:25
  • `%` doesn't mean anything in a regular expression, so that matches anything like *literally* `P%` or `D%`. Instead things like `.` and `*` are significant. – tadman Sep 09 '17 at 19:57