Submit a ticketCall us

AnnouncementsAre You “Flying Blind?”

When it comes to your complex IT infrastructure, you want to ensure you have a good grasp of what’s going on to avoid any fire drills that result from guesswork. Read our white paper to learn how proactively monitoring your IT environment can help your organization while giving you peace of mind.

Get your free white paper.

Home > Success Center > Network Configuration Manager (NCM) > NCM - Knowledgebase Articles > NCM use of Regular Expressions in Comparison Criteria

NCM use of Regular Expressions in Comparison Criteria

Created by Bill Corgey, last modified by Melanie Boyd on Jan 10, 2019

Views: 3,280 Votes: 3 Revisions: 8

Updated October 18, 2018


This article provides brief information on why .NET compliant Regular Expression may not be working if set up for use in the NCM Comparison Criteria.



All NCM versions


The following was taken from an Article written on Thwack by the NCM Product Manager.


Regular expressions are used in many places in the Network Configuration Manager (NCM). Because of technical and historical reasons, NCM uses a few different flavors of regular expressions for different functionality. In this post, I would like to explain the differences and provide references to more detailed documentation.



Informally, a regular expression is a search pattern (sequence of characters) used mainly for string pattern matching and string finding. The term originated in formal language theory where regular expressions are exactly defined and related to other concepts of the same power (regular languagesfinite automata, etc.). Although the current tools still use the term 'regular expression' (regex), it would be more precise to call them something like 'search patterns'; the expressive power of the search engine is, in fact, often much higher than that of the original regular expressions. (Many modern tools support patterns that are even more powerful than context-free languages.).



When you compare two config files for changes, you may want to ignore some of them. (Examples: certificates, last modification time.) Defining comparison criteria enables you to filter out of comparison results lines that you do not need NCM to evaluate; this saves both processing time and, more importantly, makes the review of compared files easier.


The regular expressions you create and enable in the settings (Settings -> NCM Settings -> Comparison Criteria) are used throughout NCM — for example, in performing scheduled jobs — wherever the software needs to compare config files as part of its work. A few criteria that are often used come with NCM out of the box; you can also define your own. The lines you typically want to ignore are often informational comments like when was the configuration changed last.


NCM uses the well-known diff tool (from the GNU Diffutils package - (© 2010 Free Software Foundation, Inc., available at, obtained on January 9, 2019) for config file comparisons. As you can find in Diffutils documentation -  (© 2010 Free Software Foundation, Inc., available at, obtained on January 9, 2019), diff uses grep-style regular expressions; then it's not difficult to learn from GNU grep manual (  (© 2010 Free Software Foundation, Inc., available at, obtained on January 9, 2019) that the default regex flavour for grep are Basic Regular Expressions (BRE). Please note that the diff program works line by line -- you cannot define a regex that would match multiple lines.



·         Meta-characters ‘?’, ‘+’, ‘{’, ‘|’, ‘(’, and ‘)’ lose their special meaning; you must use the backslashed versions ‘\?’, ‘\+’, ‘\{’, ‘\|’, ‘\(’, and ‘\)’. In other words, you will use backslashes to give certain characters special meaning, while many other regex implementations use backslashes to take the special meaning away.

·         You have to use '%%' in the pattern when you want to match '%'.


More details on BRE syntax can be found  (© 2003-2019 Jan Goyvaerts, available at, obtained on January 9, 2019) .




Last modified