JupiterHost.Net wrote:
Howdy list,


I'm trying to see if I can do this in one regex instead of multiple stage, mainly for educational purposes since I already have it in multipel steps.

I am trygin to get each string between { and } where the {} occurs between double quotes. So with

"file.optcondition={/Root/Get/Peter}&ampc={/Root/Get/do}&bleah"={/Root/Blah}

I want /Root/Get/Peter and /Root/Get/do

Seems I could do it if I could do the first grouping wihtout using the matching () but I dont; thinkm that is possible, any ideas woudl be great!

Danke!

#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper;

my $string = q("file.optcondition={/Root/Get/Peter}&ampc={/Root/Get/do}&bleah"={/Root/Blah});

Not what you asked for, but probably more correct:


my @matches;

use Regexp::Common;
my @quoted = ($string =~ /$RE{quoted}/g);

foreach my $quoted ( @quoted ) {
    push( @matches, ($quoted =~ /$RE{balanced}{-parens=>'{}'}/g) );
}

print join "\n", @matches;

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to