Documentation forNetwork Configuration Manager

Exclude config content from comparison in NCM

You can identify lines or blocks of text that you do not want NCM to evaluate when it compares configs. For example, you can exclude:

  • Empty lines
  • Lines that do not represent substantive changes, such as a Last Updated line
  • Expected differences, such as the hostname value
  • Blocks of text that do not represent substantive changes, such as the certificate section of the config

Excluding this content speeds up the comparison process and makes reviewing the compared configs easier. It can also prevent NCM from flagging inconsequential or expected differences when it compares a downloaded config to a baseline.

NCM uses regular expressions to identify the content that it should ignore during comparisons. You can create and manage regular expressions on the Comparison Criteria page. NCM uses comparison criteria in the following comparison operations:

Comparison operation When Comparison criteria is used
Manual comparisons Always
Config change reports Always
Scheduled jobs Always
Comparing configs to baselines If the option to apply comparison criteria is selected in the baseline definition

Access the Comparison Criteria page

From the Comparison Criteria page, you can create, edit, enable, disable, or delete a regular expression.

  1. Click Settings > All Settings.
  2. Under Product Specific Settings, click NCM Settings.
  3. Under Config Settings, click Comparison Criteria.

Create a regular expression

Create a regular expression that identifies the text that NCM should ignore when comparing configs.

See Regular expression examples for some regular expressions that are commonly used to exclude lines and blocks. Other resources, such as www.Regular-Expressions.info, are available online to help you learn more about regular expressions.

  1. On the Comparison Criteria page, click Add New.
  2. Enter a descriptive title.
  3. Identify the text to exclude:

    • To exclude a single line, enter a regular expression that identifies the beginning of the line.

    • To exclude a block of text:

      1. In the RegEx pattern box, enter the regular expression that identifies the beginning of the first line in the block.

      2. Select Is block.

      3. In the End RegEx pattern box, enter the regular expression that identifies the beginning of the last line in the block.

        The search for the pattern that identifies the end of the block is "lazy." That means if the pattern occurs multiple times, NCM finds the first occurrence of the pattern.

  4. To activate this regular expression, select Enable NCM to ignore this pattern. Otherwise, leave it disabled for future editing.
  5. Click OK.

When you create and enable a new regular expression, it applies to manual config comparisons immediately. However, you must download the config again before the new regular expression affects config change reports and charts (such as the Overall Configuration Changes Snapshot).

Edit a regular expression

  1. Select a regular expression on the Comparison Criteria screen, and click Edit.
  2. Update any values on the Edit RegEx Pattern dialog.
  3. Click OK.

Enable or disable a regular expression

Select one or more regular expressions on the Comparison Criteria screen, and click Enable or Disable.

Delete a regular expression

Select one or more regular expressions on the Comparison Criteria screen, and click Delete.

Regular expression examples

The following are examples of regular expression patterns you can use to exclude config lines or blocks from comparison.

RegEx pattern End RegEx pattern Description
^! Last   Ignores the !Last Configuration change line in Cisco configurations.
^ntp clock-period  

Ignores the ntp clock-period line in Cisco configurations.

^wlccp ap username cisco   Ignores the wlccp line in Cisco access point configurations.
certificate ca quit Ignores all lines in a certificate block that starts with certificate ca and ends with quit.