Forum Moderators: open
if you are using mysql, regexp became case insensitive with V3.23.4 so use "BINARY" on the column to force case sensitivity:
SELECT * FROM table_name WHERE BINARY column_name REGEXP '^[A-Z]*$';
if you want to allow blanks as well, add that to the pattern:
SELECT * FROM table_name WHERE BINARY column_name REGEXP '^[A-Z ]*$';
'^[A-Z]*$'
chooses fields that contain 0 or more characters A-Z, which matches almost every row in my table.
Instead...
SELECT * FROM dict WHERE BINARY wordnospaces REGEXP '[^A-Z]'
selected all the rows that contained any character that was not A-Z