in reply to Regex to match a Cisco ACL
A simple and easy to debug approach is to build your regular expression from other regular expressions that you have tested before. For example:
my $re_protocols = qr/ip|tcp|udp|object-group\s+(\w+)/; my $re_port = qr/eq\s+(\d+)|range\s+(\d+)\s+(\d+)|/; my $acl = qr/access-list \s+ (\w+) # name \s+ (\w+) # action \s+ ($re_protocols) \s+ # ... and so on /x;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex to match a Cisco ACL
by Anonymous Monk on May 22, 2011 at 10:24 UTC |