Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Match Regex in Condition Builder

Bjoern3
Tera Guru

Hi all, I was wondering if someone could set me right. I am trying to use the "matches regex" operator in the condition builder for an assignment rule. So I set: 

Short Description - matches regex - /\bSAP\b

That does not work. I tried "/\bSAP\b", "./\bSAP\b", "/\bSAP\b/g", "/\bSAP\b/", "\bSAP\b" (without "" obviously)

All those work fine in the Regex tester, but I get no hit if I use it in Servicenow

What I am trying to do is find instances of SAP but not ASAP, disapear, etc. 

 

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

check below link:

https://community.servicenow.com/community?id=community_question&sys_id=3e914769db98dbc01dcaf3231f96...

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Bjoern3
Tera Guru

Hi Ankur,

I found that one as well, but, as the last answer is three years old, I thought this might have been addressed. I do not want to work with script includes and whatnot for a simple condition.

Regards

Bjoern

Shafi3
Tera Contributor

If you are looking how to utilize a RegEx pattern in a ServiceNow condition, here it is:

Using an online tool, I created and tested then copied and pasted “as is” in a condition such as below. ServiceNow takes care of adding any prefix or suffix.

 

find_real_file.png

K_ McGraw
Tera Contributor

Bjoern,

Did you find a solution?  I am experiencing the same thing.  

Thanks!

Kim