Tenebris
Tenebris

Reputation: 83

Trying to find a string with RLIKE that contains [text]

Hi I am trying to find all strings in my database that have a format as folowed sometext [sometext] sometext. I tried to do it like this:

SELECT AlbumName
FROM album
WHERE AlbumName RLIKE '.*[.*].*';

The problem I think I have that RLIKE takes [.*] as [a-z] and I get back everything.

Upvotes: 2

Views: 451

Answers (1)

Pham X. Bach
Pham X. Bach

Reputation: 5442

You should escape the character [ and ]

SELECT AlbumName
FROM album
WHERE AlbumName RLIKE '.*\\[.*\\].*';

Upvotes: 1

Related Questions