
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2018 11:00 AM
This script doesn't seem to be working, any thoughts on this please? Is this the way we use a Regex expression in glide filters? Also, my expression is ATF followed by a 5 digit number, I hope the expression is correct?
var re= new RegExp('ATF[0-9]{5}');
var a= new GlideRecord('sys_user_group');
a.addQuery('name','STARTSWITH',re);
a.query();
if(a.next())
{
gs.print("found");
}
else
gs.print("not found);
Solved! Go to Solution.
Labels:
- Labels:
-
Scripting and Coding
-
Team Development
1 ACCEPTED SOLUTION

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2018 11:37 AM
Got it myself:
GlideFilter and Regular Expression Match
This is a great blog.
var filter= 'nameMATCH_RGXATF[0-9]{5}.*'; //name starts with ATF followed by 5 digit number
var a= new GlideRecord('sys_user_group');
a.query();
while(a.next())
{
if (GlideFilter.checkRecord(a, filter))
gs.print(a.name);
}
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2018 11:37 AM
Got it myself:
GlideFilter and Regular Expression Match
This is a great blog.
var filter= 'nameMATCH_RGXATF[0-9]{5}.*'; //name starts with ATF followed by 5 digit number
var a= new GlideRecord('sys_user_group');
a.query();
while(a.next())
{
if (GlideFilter.checkRecord(a, filter))
gs.print(a.name);
}