With /".*"/mg
your match
- starts with
"
- and then
.*"
matches every character (except \n
) as much as possible till "
- since you use
/g
and match stopped at second "
, regex will try to repeat first two steps
/m
doesn't make difference here as you're not using ^
or $
anchors
Since you have escaped quotes in your example, regex is not the best tool to do what you want.
If that wasn't the case and you wanted everything between two quotes, /".*?"/gs
would do the job.