use strict; use warnings; my $textInner = '(outer(inner(most "this (shouldn\'t match)" inner)))'; my $innerRe; my $idx=0; my(@match); $innerRe = qr/ \( ( (?: [^()"]+ | "[^"]*" | (??{$innerRe}) )* ) \)(?{$match[$idx++]=$1;}) /sx; $textInner =~ /^$innerRe/g; print "inner: $match[0]\n";
In reply to Re: A regexp to parse nested brackets containing strings
by Anonymous Monk
in thread A regexp to parse nested brackets containing strings
by dfaure
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |