Have a tricky problem down here.
Lets say I have table 'books', which has column 'title'. And I have one row with 'title' = 'MyBook'.
I want using REGEXP search for book title and I want to quote all searchable string to literal sequence:
SELECT * FROM books WHERE title REGEXP '\\QMyBook\\E';
When I work with mariaDB my query works fine. DB recognises this quotation marks. But when I work with plain MySql this query returns nothing. The problem is not in backslashes, I think MySql have troubles to work with "\Q" and "\E". Maybe there is a way to do my goal in other way, but I realy don't want to escape every character separately.
I execute this query from java. But plain query from console works the same way
The problem is - it is really necessary to use REGEXP (not LIKE) operator because of some reasons.
But I don't want that query with regexp special characters (for example 'My.ook') work here. I need that any string, with or without regexp special symbols, processed by mysql as literal sequence(if we pass 'dot' - we are looking for 'dot', not for 'any character')
\Q...\Eescape sequence, see the documentation. If you can provide an explanation what you want to do, I might be able to help further.