Regexp - How to find capital letters only in MySQL

I am trying to remove two capitalized words in series with MySQL. For example: "ABC", "AA", "NBC". There are no others.

The following query does not work (it finds all words that have 2 letters)

WHERE names REGEXP '[AZ][AZ]' 

Do you know how to do this?

+7
source share
3 answers
 WHERE names REGEXP BINARY '[AZ]{2}' 

REGEXP is not case sensitive unless used with binary strings.

http://dev.mysql.com/doc/refman/5.5/en/regexp.html

+15
source

try it

([AZ]+)

it will match all uppercase letters

0
source

This pattern matches two or more leading uppercase characters:

 WHERE names REGEXP BINARY '^[AZ]{2,}'; 
0
source

All Articles