I don't understand why the following code, using Regexp::Common balanced regular expression does not work:
#use strict; use Regexp::Common qw /balanced/; my $file = <<END; * Converting valif() v1 0 1 pwl 0 -5 10n 5 e2 2 0 value=valif(v(1)>0, 2, -2) .tran 10n 10n .plot tran v(1) v(2) END #my %RE; my @file = split('\n',$file); my $re_valif=${RE}{balanced}{-keep}{-parens=>'()'}; print $re_valif . "\n"; foreach (@file) { print $_ . "\n"; /${RE}{balanced}{-parens=>'()'}/ and print "->Matched |$1|$2|$3|$4 +|\n"; }
In reply to Regex::Common balanced does not seem to work by ala_poubelle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |