<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Regex Parse of HTML in ServiceNow AI Platform forum</title>
    <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/regex-parse-of-html/m-p/1123775#M80164</link>
    <description>&lt;P&gt;I have a string of&amp;nbsp;"&amp;lt;title&amp;gt;This is a string&amp;lt;/title&amp;gt;" and I need to set the values between the tags as a variable thus returning "This is a string" (without quotes of course)...&lt;/P&gt;
&lt;P&gt;I tried this but it does not work...&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;var str = "&amp;lt;title&amp;gt;This is a string&amp;lt;/title&amp;gt;";&lt;/EM&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;var mySubString = str.substring(str.indexOf("&amp;lt;title&amp;gt;") +1, str.indexOf("&amp;lt;/title&amp;gt;"));&lt;/EM&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;gs.print(mySubString);&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Am i going to have to Regex to get this value ?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Feb 2022 21:49:54 GMT</pubDate>
    <dc:creator>john_duchock</dc:creator>
    <dc:date>2022-02-22T21:49:54Z</dc:date>
    <item>
      <title>Regex Parse of HTML</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/regex-parse-of-html/m-p/1123775#M80164</link>
      <description>&lt;P&gt;I have a string of&amp;nbsp;"&amp;lt;title&amp;gt;This is a string&amp;lt;/title&amp;gt;" and I need to set the values between the tags as a variable thus returning "This is a string" (without quotes of course)...&lt;/P&gt;
&lt;P&gt;I tried this but it does not work...&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;var str = "&amp;lt;title&amp;gt;This is a string&amp;lt;/title&amp;gt;";&lt;/EM&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;var mySubString = str.substring(str.indexOf("&amp;lt;title&amp;gt;") +1, str.indexOf("&amp;lt;/title&amp;gt;"));&lt;/EM&gt;&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;gs.print(mySubString);&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Am i going to have to Regex to get this value ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 21:49:54 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/regex-parse-of-html/m-p/1123775#M80164</guid>
      <dc:creator>john_duchock</dc:creator>
      <dc:date>2022-02-22T21:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Parse of HTML</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/regex-parse-of-html/m-p/1123776#M80165</link>
      <description>&lt;P&gt;Ah...&amp;nbsp; got it:&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;var inText = current.variables.body_html;
var regex = /(?:\&amp;lt;title&amp;gt;)(.*)(?:\&amp;lt;)/g;
inText = regex.exec(inText);
var rslt = inText[1];
current.description = rslt;
current.short_description = rslt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Feb 2022 22:14:18 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/regex-parse-of-html/m-p/1123776#M80165</guid>
      <dc:creator>john_duchock</dc:creator>
      <dc:date>2022-02-22T22:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Parse of HTML</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/regex-parse-of-html/m-p/1123777#M80166</link>
      <description>&lt;P&gt;Generally speaking - yes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a little trick that works to strip out html tags without having to hard-code them individually.&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-markup"&gt;&lt;CODE&gt;var str = "&amp;lt;title&amp;gt;This is a string&amp;lt;/title&amp;gt;";

var mySubString = str.replace(/(&amp;lt;([^&amp;gt;]+)&amp;gt;)/gi, "");

gs.print(mySubString);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I hope this helps!&lt;/P&gt;
&lt;P&gt;If this was helpful, or correct, please be kind and mark the answer appropriately.&lt;/P&gt;
&lt;P&gt;Michael Jones - Proud member of the GlideFast Consulting Team!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 22:17:44 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/regex-parse-of-html/m-p/1123777#M80166</guid>
      <dc:creator>Michael Jones -</dc:creator>
      <dc:date>2022-02-22T22:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Parse of HTML</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/regex-parse-of-html/m-p/1123778#M80167</link>
      <description>&lt;P&gt;How do you accomplish this is Flow Designer using the transform function regex?&lt;/P&gt;</description>
      <pubDate>Sat, 20 Aug 2022 21:22:41 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/regex-parse-of-html/m-p/1123778#M80167</guid>
      <dc:creator>Troya1</dc:creator>
      <dc:date>2022-08-20T21:22:41Z</dc:date>
    </item>
  </channel>
</rss>

