Regular Expressions for IECs
Introduction | Configure | Test | Examples
Introduction
While most scenarios to Create and Manage IECs and IECMs can be addressed via the out-of-the-box List View Filters, we can use Regular Expressions for advanced conditions not supported by the List View.
Examples of these limitations include rules that require parsing of a certain number of characters or a combination of specific characters at predetermined positions.
Configure
To configure Regular Expressions, we need to:
Create an IEC along with its corresponding IECM, following the standard steps
Navigate to the IECM to modify the Query Filter to configure the Regular Expression
NOTE: ServiceNow does not provide the ability to configure Regular Expressions out-of-the-box via the List View Filters
Test
Another important consideration is how the Query Filters using Regular Expressions are tested.
Since the ServiceNow List View doesn't support Regular Expressions, we can't visually validate the results of the Query Filter.
So the testing needs to be done by executing the analysis on the relevant Discovery Logs to ensure that we are getting the newly created IEC, as expected.
This is because the MATCH_RGX works in the background, but not in the List View UI.
Examples
See the examples below for Regular Expressions using MATCH_RGX:
Example 1: error_code=P2.WMI.01^device_dns_nameMATCH_RGX.*vc[0-9]{3}
Example 2: device_dns_nameMATCH_RGX[\w]{7}\.com
Example 3: device_dns_nameMATCH_RGXctx\w+\d+\.com
Note the use of '\' (slash) as an escape character for '.' (dots) in the matching string, as you can see with '\.com'
This article assumes an understanding of Regular Expressions and only provides guidance, syntax, and limitations on how they can be used in ServiceNow for Discovery Admin.