Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Problem with alternating regex?

by jwkrahn (Monsignor)
on Sep 11, 2012 at 03:38 UTC ( #992912=note: print w/replies, xml ) Need Help??


in reply to Problem with alternating regex?

$ perl -le' for my $line ( q/set zone "VLAN" vrouter "trust-vr"/, q/set zone id 10 +0 "Internet_Only"/ ) { if ( $line =~ /^set\szone\s(?:"([^"]*)"|id\s\d+\s"([^"]*)")/ ) { my $zone = $^N; print $zone; } } ' VLAN Internet_Only

Or:

$ perl -le' for my $line ( q/set zone "VLAN" vrouter "trust-vr"/, q/set zone id 10 +0 "Internet_Only"/ ) { if ( $line =~ /^set\szone\s(?:id\s\d+\s|)"([^"]*)"/ ) { my $zone = $1; print $zone; } } ' VLAN Internet_Only

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992912]
help
Chatterbox?
NodeReaper says "Shhhh! Be vewy vewy quiet, I'm hunting wumpus"

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2017-06-25 07:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (564 votes). Check out past polls.