- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 01:33 AM
Hi All,
I have configured custom RegEx to extract the required information in an event.
Whenever I am trying to add the below RegEx expression in event rule, its asking two fields to select.
Regex is working as expected in Regex101.com (Green color background is the one which I need as output)
In instance its asking two expression to select or add while i am using the custom regex. Can anyone help me how I can address this?
Regards,
Ganesh
Solved! Go to Solution.
- Labels:
-
Event Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 05:01 AM
Hey,
have you tried matching it without any grouping?
Something like: \S+\s+\S+\s+\S+\s+(\S+)
Maybe the issue is something else.
Regards
Fabian

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 01:48 AM
Hey,
This is caused by how ServiceNow interprets RegEx, which is differently from other common regex testers. ServiceNow seemingly has difficulty utilizing non-capturing groups and instead seems to think you "non-capturing" group is also something you want to extract.
The easiest fix is to just roll with it IMO. It's not great, but just give the first (non capturing group) a meaningless attribtue. This is also summarized here: Event Management - Event Rules - Regex Parser How-To - Support and Troubleshooting (servicenow.com)
Recommendation: Just ignore the groups you don't need.
This is why it asks you for 2 attributes. Just "ignore" the first one you set and use the second one.
Regards
Fabian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 03:16 AM
Hello @Fabian Kunzke
Thank you for your reply. Event after ignoring the group I don't want and mapped the group which is necessary, I am getting empty value in output. Any thoughts on this?
RegEx is working as expected in https://www.freeformatter.com/java-regex-tester.html#before-output
Regards,
Ganesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 05:01 AM
Hey,
have you tried matching it without any grouping?
Something like: \S+\s+\S+\s+\S+\s+(\S+)
Maybe the issue is something else.
Regards
Fabian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2024 11:12 PM
Thank you @Fabian Kunzke . It worked.