mysql - REGEXP not working with character names -
according http://dev.mysql.com/doc/refman/5.1/en/regexp.html, can use [.plus-sign.]
instead of [.+.]
so why below 2 queries give me different results in mysql 5.6.17 :
select case when '+123' regexp '^[.+.][0-9]+$' 1 else 2 end;
(gives result 1)
select case when '+123' regexp '^[.plus-sign.][0-9]+$' 1 else 2 end;
(gives result 2)
using character names pretty neat if worked expected. doing wrong?
you need use [[ character class ]]
this:
select '+123' regexp '^[[.plus-sign.]][0-9]+$'; 1
Comments
Post a Comment