Answer the question
In order to leave comments, you need to log in
Why does the regular expression take the last occurrence of a substring and not the first?
Please help me. It is necessary to write a regular expression so that it selects what begins with INSERT INTO, then anything (including line breaks) and ends with the first occurrence of ');' .
Here's what I made.
$result = preg_match_all("/INSERT INTO(.|\n|\r)*\)\;/i", $content, $inserts);
but it doesn't work like that. Selects from INSERT INTO until the last ');' , and it is necessary to the first.
Thank you.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question