Why your regular expression takes the last occurrence of a substring and not the other?

Please help me. We need the regular season to write to choose what starts INSERT INTO then anything (including newline) and ends at the first occurrence of the ');' .

Here's what I made.
$result = preg_match_all("/INSERT INTO(.|\n|\r)*\)\;/i", $content, $inserts);
but it is not working. Choose from INSERT INTO to the last ');' , and it is necessary to first.
Thank you.
July 8th 19 at 16:20
1 answer
July 8th 19 at 16:22
Lazy you just.
And to be greedy.


The flag of the U (ungreedy) to help
Thank you so much! - Holly58 commented on July 8th 19 at 16:25

Find more questions by tags ParsingPHPRegular expressions