Reputation: 320
according to mysql regex we can use [[:space:]]*
instead of \s*
so I have this query
select * from onet.tools_and_technology where t2_example Rlike '[[:space:]]*C++[[:space:]]*';
but it gives me this error
Error Code: 1139. Got error 'repetition-operator operand invalid' from regexp
what I'm missing here??!!
Upvotes: 2
Views: 1657
Reputation: 6173
The +
character is similar to the *
character in a regex: they're meta characters.
You need to escape each character with \
. Because you are working in a string, you will need to escape the escape: '[[:space:]]*C\\+\\+[[:space:]]*'
Your problem can be solved without regexes, though: LIKE '% c++ %'
This is much more readable.
Upvotes: 3