Problems with matching spaces with MySql REGEX

I am trying to match all phones in the database that do not match the format of this example '(11) 1234-5678'.

I'm having trouble defining a regular expression due to a space, I did the following tests:

SELECT '(11) 1234-5678' REGEXP "\([0-9]{2}\)" -> 1 SELECT '(11) 1234-5678' REGEXP "\([0-9]{2}\).*" -> 1 SELECT '(11) 1234-5678' REGEXP "\([0-9]{2}\) " -> 0 SELECT '(11) 1234-5678' REGEXP "\([0-9]{2}\)[:blank:]" -> 0 SELECT '(11) 1234-5678' REGEXP "\([0-9]{2}\)[:space:]" -> 0 

I have absolutely no idea why I cannot get mysql to match a space.

EDIT:

I am using mysql 5.5.24

+6
source share
1 answer

Using:

 SELECT '(11) 1234-5678' REGEXP "\\([0-9]{2}\\)[[:space:]]" 
+5
source

Source: https://habr.com/ru/post/926934/


All Articles