MySQL RegEx: Got error ’empty (sub)expression’ from regexp

I have a column participants which containts a value like “99005|99001|99002|99001999|99004” which are user logins.

What exactly I want is to match “99001” without matching “99001999”.

Here is my method:

SELECT * FROM `bv_sklad_products` WHERE `stage`=4 AND `participants` REGEXP ('^([^|]+(|))*(99001|99005)((|)[^|]+)*$') AND `start_date` BETWEEN '2015-07-09' AND '2015-07-10' ORDER BY `id` DESC LIMIT 0,100

And the error message I get:

Got error 'empty (sub)expression' from regexp

What am I doing wrong?

Source: regex

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.