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.

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

I see that you have had your share of trouble


I agree that my workaround is not really fit for huge results.


Abhinay Erra
Giga Sage

Your syntax will be



<field > matches regex   ^.{0,11}$


Abhinay, this is not working.


Here you go, use this. I have tested this and it is working on my end.\



<field > matches regex .{0,11}



find_real_file.png


Strange - using this in a report source, I get this error. Helsinki instance. Any idea?


That is exactly what   PRB603878 is about.


find_real_file.png