Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2020 11:34 PM
Hi Team,
Can anyone share the regular expression code to validate incident number in Snow.
I'm trying as below:
var userTI = "INC\d{7}";
Its not working!
Please help
Thanks,
Sri
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2020 11:43 PM
Hi,
try this
var str = 'INC0012345';
var regex = /^INC\d{7}$/;
var val = regex.test(str);
gs.info(val);
Output:
Regards
Ankur
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2020 11:43 PM

Community Alums
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2020 11:43 PM
Hi,
the regex should be like:
var regex = /INC\d{7}/g;
then you can just use regex.test(STRING TO TEST)
Cheers,
Joro