use strict; use warnings; my $textInner = '(outer(inner(most "this (shouldn\'t match)" inner)))'; my $innerRe; $innerRe = qr/ \( ( (?: [^()"]+ | "[^"]*" | (??{ $innerRe }) )* ) \) /sx; $textInner =~ /^$innerRe/g; print "outer: $1\n";
(Sorry, I took out the comments to debug. Feel free to re-add them.)
In reply to Re: A regexp to parse nested brackets containing strings
by ikegami
in thread A regexp to parse nested brackets containing strings
by dfaure
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |