Answer the question
In order to leave comments, you need to log in
MySQL REGEXP. How to escape the "[" character?
Friends, good night.
Tell me, please, what template can be used to escape a string?
so that it can insert into mysql-query
SELECT ....... WHERE title REGEXP '".$query."' ...
Now an error is thrown due to the character "[".. But I can't escape it in any way..
I try like this:
Please tell me the correct shielding .. I would be very grateful. $query = "[hjybrb";
str_replace("[", "\[", $query)
Answer the question
In order to leave comments, you need to log in
You were only a minute away from the solution: for some historical reason, there should be two slashes :/str_replace ('[', '\\[', $query)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question