in reply to How can I find nested delimiters?
This works because the regex is greedy.my $query = qq("SOME QUERY WITH "" (DOUBLE QUOTES)" YEEHA); if ($query =~ /"(.*)"(.*)/) { my $inside = $1; my $outside = $2; print $inside, "\n", $outside, "\n"; }
But I'm not sure if this is really what you want-- was that query merely an example, or is that really what all your queries look like?
If it's the former, and you're trying to do something more complicated than what you describe above--for example, match balanced text--you might take a look at perlfaq6, Can I use Perl regular expressions to match balanced text?.
Also, see Text::Balanced on CPAN. -- Ed.
|
|---|