Scripting question: Regex expression in glide filters

Nitesh Balusu
Giga Guru

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);