RegEx in condition builder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2012 02:16 AM
Hello,
In the condition builder we now have the 'matches regex' operator. ...But what are all the regex we CAN use in it?
For example: beginning of line operator '^' does not play nicely with the condition builder in this case as it is assumed it means AND and will add a second condition when saving.
Is there some other character denoting beginning of line for the condition builder? What other exeptions might there be and do they have workarounds?
thanks in advance,
Jaakko Jalo

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2012 05:23 PM
JavaScript Regex I believe.
^ should be beginning of line
See http://www.w3schools.com/jsref/jsref_obj_regexp.asp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2013 11:14 AM
I can't get any 'Match Regex' expressions to work at all. I am using the 'Match Regex' in a gauge. It just keeps throwing errors:
Syntax Error or Access Rule Violation detected by database (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MATCH_RGX '\\RTY\\'' at line 1)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2013 10:43 AM
I haven't tested all the methods for regex in Service-Now. But I can say for certain that .match() and .test() work as I am using them in a few scripts.
I haven't used the 'matches regex' in the condition builder yet, however I would approach the issue by ensuring that .match() is matching what you are intending. You can test it by using a GlideQuery and adding conditions that match that of the intended filter. If it checks out then it must be a S-N issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2014 02:07 PM
I am also trying to get this working. I have a classifier that I wish to match java processes that have parameters of max length at 4066 characters. Our Linux kernels have a max field length that some processes are overflowing. Since I cannot reliably determine what these are, I want to match them early in Classification and name them "Unknown" in the Java Server table.
The conditions should look like this:
Name is java
Parameters matches regex ^.{4066}$
But as you say, the ^ symbol is interpreted as an AND and causes issues on Update.
Does anyone know how to enter regex into this field?