ServiceNow server side regex (SNC.regex) - extract text between html tags

 var sStr='<h3>OPEN Problem P-22061362 in environment <i>Non Production</i></h3><br><small>Problem detected at: 10:27 (UTC) 09.06.2022</small><hr><b>1 impacted infrastructure component</b><hr><br><div><span>Process</span><br>';
 

var sRegexQ='/(?<=\<small\>)(\s*.*\s*)(?=\<\/small\>)/'

var pattern= new SNC.Regex(sRegexQ);
 

var results = pattern.match(sStr);
       while (results !== null) {
               gs.print("match: " + results[0]);
               results = pattern.match();
       }

Comments

Popular posts from this blog

GlideRecord setValue

URL link in addInfoMessage