View Single Post
  #4  
Old 02-17-2016, 03:35 PM
Casey Casey is offline
Registered User
 
Join Date: Oct 2011
Posts: 114
Quote:
Originally Posted by clay584 View Post

For example:

network 10.0.0.0 0.0.0.255 area 0

regex: ^network\s+(\d+\.\d+\.\d+\.\d+)\s(\d+\.\d+\.\d+\.\d+) area \d+

This would match the whole line, but then you pick one color for the first capture group, and pick another color for the second capture group.

network 10.0.0.0 0.0.0.255 area 0
For this limited example, I'd use a regex string to match IPs and a different one to match subnet/wildcard masks.

This is from my 'cisco words' keyword file I shared a while back:

For Subnet/Wildcards: (?:)(?:0|255)\.(?:[0-9]{1,3}\.){2}[0-9]{1,3}

For IPs: (?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/[0-9]{1,2}|:[0-9]+|\W)?(?:\x20|$)

It's not perfect (IE: the first octect must be either '0' or '255' for it to match the mask properly), however it works 'good enough' in most cases and is more robust than matching a single OSPF config line.

Hope it helps,
CB
Reply With Quote