I have an regex expresion which is like this
preg_match("/^\\s*(insert|delete|update|replace|create|drop|alter|use) /i",$query)
This is a part of a pretty old function which is responsible for allmost all of the transactions on our site that we maintain (it is like 8 years old at min…)
Imagine my suprice when this query failed te test on this regex….
"DELETE
FROM KursSmer
WHERE IDKurs = '523' AND
IDSmer = '50' AND
IDSkolskaGodina = '1' AND
JeObavezan = '0'"
It took me about 1h to get the nasty fella… but i did it… there was a \n line element on the end of the first row just next to DELETE word… like DELETE\n
Now, I am left wondering if this can be corrected?
You need
mmodifier for multiple lines.Pattern Modifiers