I'm attempting to create a Regex statement in the Comparison Criteria section of NCM. This section of the tool uses Regex to identify patterns to ignore when comparing configuration files.
I want to create an expression to ignore 'switchport' on a specific device. 'Switchport' appears on several lines throughout the configuration file. I'm trying to identify the device by using the host name.
My original thought was to have the Regex statement identify any instance of 'switchport' only when the 'hostname' criteria is met. Creating the rule inherently ignores the line during comparison, so my first thought was to identify each line with 'switchport' only when the hostname matches the criteria.
Here's my current Regex statement, but it's not ignoring the switchport lines I want for the host (using AB-CD-01 as an example hostname):
(?m)^hostname\s+AB-CD-01(?:\r?\n(?!hostname\b).*)*\r?\n.*switchport.*$
Has anyone used comparison criteria excepts for a specific host?
Has anyone used comparison criteria excepts for lines that are repeated throughout config files?
^ I'm attempting to combine these ideas.