Matches Regex in Condition Builder

gtke
Tera Contributor

I'm trying to build a condition which matches a string to a regular expression. Matches Regex is a default option in the condition builder for String-type fields, per the wiki Condition Builder - ServiceNow Wiki. However I can't seem to figure out the proper syntax. I did find this community thread: RegEx in condition builder which was helpful but didn't solve the problem. I'm trying to match a field when it has 11 or fewer characters (large text field, used for descriptions etc). From research, the regex I should use is .{0,11}$ -- any character from 0 to 11 occurrences, followed by string end. I know for a fact there are records matching this condition, but the query returns nothing.

12 REPLIES 12

Hi Abhinay & Sebastian - I just posted a blog article GlideFilter and Regular Expression Match   summarizing all I know about GlideFilter, and also referenced your post. Any feedback would be great. Thanks.



Please feel free to connect, follow, mark helpful / answer, like, endorse.


John Chun, PhD PMP see John's LinkedIn profile

visit snowaid


ServiceNow Advocate

beant1
Tera Contributor

I opened a ticket in HI for this same issue yesterday.   This is the response I received:



The "matches regex" issue that you are experiencing is a known problem ticket that is documented in (PRB603878).This problem ticket has since been closed. Unfortunately Our Development team has decided not to fix the issue after considering the severity and frequency of the issue, as well as the the cost and risk of attempting a fix.



As a workaround, it looks like I will have to investigate using an advanced reference qualifier, referencing a script include, as described by Janel Hagstrom in this thread:   Need syntax for "matches regex"



--Thomas Bean


Daniel Oderbolz
Kilo Sage

Probably this can nowadays be simplified with GlideFilter (see GlideFilter and Regular Expression Match).
I did not try it yet, however.

(It would be better if it was built in as it was in the past...)


If this answer was helpful, I would appreciate if you marked it as such - thanks!

Best
Daniel