Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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?
Discipulus SharePoint will insinuate in my $workspace I think i'll need alot of patience..
[erix]: for all the tea in china book
[erix]: about perfide albion
[erix]: I guess that should be Perfidious Albion
Discipulus must prepare some ammunitions: XML::Compile::SOAP but what the heck!

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2017-06-27 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (601 votes). Check out past polls.