Hi, I was hoping someone could help me figure out why I can't seem to make an alternating match work. I've been stumped on this one for a couple days..
Here is the code. Basically I want to match the first value found between double quotes although there are two different formats for the lines:
set zone "VLAN" vrouter "trust-vr"
set zone id 100 "Internet_Only"
In both cases I want to capture the first value and was hoping to do it in a single regex.
Here is what I have that isn't quite working:
if ($line =~ /^set\szone\s("([^"]*)"|id\s\d+\s"([^"]*)")/) { my $zone = $1; print "Config line=> $lineCount; Value=> $line; zone=> $ +zone\n"; }
Any ideas? It matches properly on: set zone "VLAN" vrouter "trust-vr", but the second line is returning: id 100 "Internet Only" when I only want what's between the quotes?
Thanks!
In reply to Problem with alternating regex? by dwlepage
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |