I need: a regexp for MySQL (php, PDO) usage. Regexp should find all numbers between brackets [ ], except number 150.
So I would like to get:
[3]
[25464]
[510]
But I would like to exclude:
[150]
What I got:
\[{1}((?!150)[0-9])+\]{1}
and it works fine for newest version of MySQL, but I need something that would work also on an older version (probably 5.1).
Problem: Currently I get an error:
1139 - Got error 'repetition-operator operand invalid' from regexp
I know I can't use ?. How can I replace it?
Additional info (edit): I'm redesigning the database and that's why I need to write this
II edit - why I need this: I need to retrieve all rows which in column "content" contains only one specified [150]. One column 'content' can contain zero [nr] or one specific [nr] or many different [nrs].
WHERE content REGEXP '\[{1}((?!150)[0-9])+\]{1}' = 0 AND content LIKE '%[150]%'