Regular Expression is not working in Event Rule Transformation

Rob M1
Tera Contributor

Hello Community!

 

This has been driving me crazy the past hour or so.

 

I am trying to write a Regex that will match the name of a server from the corresponding event description. The Regex should match the first word in parenthesis BEFORE the '\' character.

 

I have a Regex that tests fine in the Regex101 tester configured according to ServiceNow's KB article:  

RobM1_0-1706290492397.png

 

But no matter what I do, I cannot for the life of me get the Regex to match anything in the event rule designer:

RobM1_1-1706290579319.png

RobM1_2-1706290674004.png

 

Can anyone see what I am doing wrong here?

 

 

Thanks in advance for your assistance!

 

Rob

 

5 REPLIES 5

Amit Verma
Kilo Patron
Kilo Patron

Hi @Rob M1 

 

From the screenshot, I can see that the regex has been changed to \((.*)\\.** from \((.*)\\.* as per the error message. Can you please check on it once ? Also, validate on the description field whether the input string for regex validation is in the right format.

 

The regex for event rules is a bit more sensitive than that and the entire string has to be captured or it would only parse correctly if the entire beginning of the string was exactly the same each time.  The Xplore regex tester unfortunately does not use the same backend regex as event management rules (nor does regex101 or most other popular testers). Refer https://www.servicenow.com/community/itom-forum/help-on-event-rule-regex/td-p/940458

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Hello Amit,

 

Thank you for taking the time to review and reply!

 

I can confirm that the regex is being saved as: \((.*)\\.*

 

I am testing my regex using the following steps provided by ServiceNow: How to test Event Management regular expressions using regex101 - Support and Troubleshooting (servi...

 

All tests are passing, however I am still not able to refresh the rule with a new event. For some reason, it continues to throw the error I screenshotted in the initial post.

 

 

Thanks again!

 

Rob

Thanks again Amit!

Unfortunately I've already found these articles in my research and none of them seem to address the issue I am experiencing. 

 

I have opened a case with support so I will update this post if/when ServiceNow is able to find a resolution.

 

 

Thanks again!

 

Rob