mysql> mysql> SELECT 'A\nB' REGEXP '^A\nB$'; +------------------------+ | 'A\nB' REGEXP '^A\nB$' | +------------------------+ | 1 | +------------------------+ 1 row in set (0.00 sec) mysql> mysql> mysql> SELECT 'AB' REGEXP '^A$'; +-------------------+ | 'AB' REGEXP '^A$' | +-------------------+ | 0 | +-------------------+ 1 row in set (0.01 sec) mysql>