The mySql REGEXP operator is not case sensitive. Is there a version of this operator that is case sensitive?
1 Answer
Use the BINARY keyword, which forces REGEXP to match the string as a binary string, which is done case-sensitively.
SELECT 'a' REGEXP 'A', 'a' REGEXP BINARY 'A';
Although this isn't explicitly stated in the docs (that you can do it with a regular string), in my experience it works as expected.
As a more complex example, the regular expression B[an]*s matches any of the strings Bananas, Baaaaas, Bs, and any other string starting with a B, ending with an s, and containing any number of a or n characters in between.