Skip to content
Advertisement

Find rows that have characters other than a plus (+) sign or number in a phone field

I want to find all rows in a phone column that have any character other than a plus sign (+) or numeric digit. It can be any character like slash, space, bracket, alphabet or any other character. The column has phone numbers, but may rows has space, brackets and slashes. I want to see those. Like:

But theses are correct:

and should not show.

I tried:

And

Error: Error in query (1139): Got error 'nothing to repeat at offset 1' from regexp

Advertisement

Answer

You were on the track with the second one. But all the characters of a class have to be in the square brackets. To negate the class the caret has to go in there as well, as first character. Outside it matches the beginning of the string.

There’s no need to use IN here though. You can filter directly with a WHERE clause.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement