← Home
🔥0 DAY
0 XP
Tools · Developer Utility

SERVICENOW
REGEX TESTER.

Build and test regular expressions for ServiceNow client scripts, business rules, inbound email actions, and ACL conditions. Pick a preset, tweak the pattern, and copy a ready-to-paste snippet.

Presets

Linked record 6816f79cc0a8016401c5a33be04be441 and parent a9e30c7d4ff1120031577d2ca310c7f3 — see logs.
2 matches

Match details

#PosValueGroups
0146816f79cc0a8016401c5a33be04be441
158a9e30c7d4ff1120031577d2ca310c7f3

Copy into ServiceNow

// Business Rule (before / after)
(function executeRule(current, previous) {
  var re = /\b[a-f0-9]{32}\b/gi;
  var text = current.short_description.toString();
  var hits = text.match(re) || [];
  gs.info('regex hits: ' + hits.length + ' → ' + hits.join(', '));
})(current, previous);

Regex gotchas in ServiceNow

  • Server scripts run on a Rhino-derived engine. Lookbehind (?<=) is unreliable on older instances — prefer capture groups.
  • In XML condition strings (sys_dictionary defaults, UI Policy expressions), escape backslashes twice — \\d in JS becomes \\\\d in XML.
  • GlideElement.toString() before .match() on server side or you may get undefined on empty fields.
  • In inbound email actions, combine email.subject + email.body_text before matching so values in either place are caught.