in reply to Need Regex help
Try this:
#!/usr/local/bin/perl $re = qr@ \{ (?: (?> [^{}]+ ) # Non-{} without backtracking | (??{ $re }) # Group with matching {} )* \} @x; my $string = 'value:patternList = "{error 1 1 {^E 0-20-9:0-50-9:0-50-9 +.*$} {^E 0-20-9:0-50-9:0-50-9.*$}} {three 1 1 {^.*35=A.*$|^.*35=5.*$} + {^.*35=A.*$|^.*35=5.*$}} {fixv 1 1 ^.*VFIXFxProxy.*Disconnected ^.*V +FIXFxProxy.*Disconnected}"'; while($string =~ m/$re/g){ print "$&\n"; } exit; __END__ output: {error 1 1 {^E 0-20-9:0-50-9:0-50-9.*$} {^E 0-20-9:0-50-9:0-50-9.*$}} {three 1 1 {^.*35=A.*$|^.*35=5.*$} {^.*35=A.*$|^.*35=5.*$}} {fixv 1 1 ^.*VFIXFxProxy.*Disconnected ^.*VFIXFxProxy.*Disconnected}
See perlre
They say that time changes things, but you actually have to change them yourself.
Andy Warhol
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Need Regex help
by Earindil (Beadle) on Sep 09, 2005 at 15:46 UTC | |
by JediWizard (Deacon) on Sep 09, 2005 at 16:01 UTC | |
Re^2: Need Regex help
by Earindil (Beadle) on Sep 09, 2005 at 15:10 UTC | |
by JediWizard (Deacon) on Sep 09, 2005 at 15:13 UTC | |
by Earindil (Beadle) on Sep 09, 2005 at 15:27 UTC |
In Section
Seekers of Perl Wisdom