<?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>topic Re: Can someone help me with regex to remove HTML tags from fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411943#M118786</link>
    <description>&lt;P&gt;@ndsouza25&lt;/P&gt;

&lt;P&gt;I worked on your second request which was a bit more difficult. But I managed to get it.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/q5fPca/3"&gt;https://regex101.com/r/q5fPca/3&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;The SPL command would look something like this:&lt;BR /&gt;
&lt;CODE&gt;yourbasesearch | rex mode=sed field=_raw "s/((?=&amp;lt;[^&amp;gt;]&amp;gt;)[^;]+;[^;]+;|&amp;lt;[^&amp;gt;]&amp;gt;|&amp;lt;\/[^&amp;gt;]+&amp;gt;|&amp;lt;[^'"]+['"]|['"][^&amp;lt;]+&amp;lt;[^&amp;gt;]+&amp;gt;)//g"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;you can change the field=_raw to another field name if you have already extracted this text into another field (optional)&lt;/P&gt;</description>
    <pubDate>Sat, 18 Aug 2018 06:42:13 GMT</pubDate>
    <dc:creator>horsefez</dc:creator>
    <dc:date>2018-08-18T06:42:13Z</dc:date>
    <item>
      <title>Can someone help me with regex to remove HTML tags from fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411935#M118778</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Could someone please help me with removing the HTML tags from fields.&lt;/P&gt;

&lt;P&gt;The data is a few sentences, such as remediation of a Microsoft patch, but contains links within.&lt;/P&gt;

&lt;P&gt;This data is coming in through a lookup that I can't modify apparently.  I'd like to get rid of the &lt;BR /&gt; &lt;A href="https://community.splunk.com/href"&gt;  &lt;/A&gt; &lt;/P&gt;&lt;P&gt; etc tags so I can just display the text in a clear format.&lt;/P&gt;

&lt;P&gt;Thank you!&lt;BR /&gt;
&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 19:55:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411935#M118778</guid>
      <dc:creator>ndsouza25</dc:creator>
      <dc:date>2018-08-17T19:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help me with regex to remove HTML tags from fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411936#M118779</link>
      <description>&lt;P&gt;please submit a sample of the data&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 20:07:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411936#M118779</guid>
      <dc:creator>marycordova</dc:creator>
      <dc:date>2018-08-17T20:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help me with regex to remove HTML tags from fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411937#M118780</link>
      <description>&lt;P&gt;Hi @ndsouza25 , as @marycordovacaa said please share some sample data... otherwise we won't be able to help you.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 20:21:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411937#M118780</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2018-08-17T20:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help me with regex to remove HTML tags from fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411938#M118781</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;Customers are advised to follow &amp;lt;A HREF='https://support.microsoft.com/en-ph/help/4343902/security-update-for-adobe-flash-player' TARGET='_blank'&amp;gt;KB4343902&amp;lt;/A&amp;gt; for instructions pertaining to the remediation of these vulnerabilities.&amp;lt;P&amp;gt; &amp;lt;P&amp;gt;Patch:&amp;amp;lt;br/&amp;amp;gt; Following are links for downloading patches to fix the vulnerabilities: &amp;lt;P&amp;gt; &amp;lt;A HREF='https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/ADV180020' TARGET='_blank'&amp;gt;ADV180020&amp;lt;/A&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Aug 2018 20:34:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411938#M118781</guid>
      <dc:creator>ndsouza25</dc:creator>
      <dc:date>2018-08-17T20:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help me with regex to remove HTML tags from fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411939#M118782</link>
      <description>&lt;P&gt;Above is a sample of the data I get from our vulnerability system.  I would like for it to read as such, but actually show the link URL instead of converting to a hyperlink:&lt;/P&gt;

&lt;P&gt;Customers are advised to follow &lt;A href="https://support.microsoft.com/en-ph/help/4343902/security-update-for-adobe-flash-player" target="_blank"&gt;KB4343902&lt;/A&gt; for instructions pertaining to the remediation of these vulnerabilities.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Patch: Following are links for downloading patches to fix the vulnerabilities: &lt;/P&gt;&lt;P&gt; &lt;A href="https://portal.msrc.microsoft.com/en-us/security-guidance/advisory/ADV180020" target="_blank"&gt;ADV180020&lt;/A&gt;&lt;BR /&gt;
&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 20:35:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411939#M118782</guid>
      <dc:creator>ndsouza25</dc:creator>
      <dc:date>2018-08-17T20:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help me with regex to remove HTML tags from fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411940#M118783</link>
      <description>&lt;P&gt;When I read "removing the html tags from fields" I immediately thought about regular expressions. &lt;BR /&gt;
Unfortunately you don't seem to want to remove them. You want to create a hyperlink.&lt;/P&gt;

&lt;P&gt;I'm not sure if I can help you with that. Sorry. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;P.S.: I'm not even sure if that is possible at all.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 21:00:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411940#M118783</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2018-08-17T21:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help me with regex to remove HTML tags from fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411941#M118784</link>
      <description>&lt;P&gt;I wrote a regex that can at least get you the raw text in the format you wanted (without the hyperlinks actually working)&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;yourbasesearch | rex mode=sed field=_raw "s/(&amp;lt;[^&amp;gt;]+&amp;gt;|(?&amp;lt;=P&amp;gt;)(?:[^;]+;)+)//g"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The result should look like this afterwards:&lt;BR /&gt;
&lt;CODE&gt;Customers are advised to follow KB4343902 for instructions pertaining to the remediation of these vulnerabilities. Following are links for downloading patches to fix the vulnerabilities:  ADV180020&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/q5fPca/1"&gt;https://regex101.com/r/q5fPca/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 21:15:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411941#M118784</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2018-08-17T21:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help me with regex to remove HTML tags from fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411942#M118785</link>
      <description>&lt;P&gt;Thank you very much!  This works great!  Is it possible to still display the URL.  I don't need it to work as a hyperlink, but just show up so someone can copy and paste it into a browser.  I really appreciate the help and quick response!&lt;/P&gt;</description>
      <pubDate>Sat, 18 Aug 2018 02:28:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411942#M118785</guid>
      <dc:creator>ndsouza25</dc:creator>
      <dc:date>2018-08-18T02:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help me with regex to remove HTML tags from fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411943#M118786</link>
      <description>&lt;P&gt;@ndsouza25&lt;/P&gt;

&lt;P&gt;I worked on your second request which was a bit more difficult. But I managed to get it.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/q5fPca/3"&gt;https://regex101.com/r/q5fPca/3&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;The SPL command would look something like this:&lt;BR /&gt;
&lt;CODE&gt;yourbasesearch | rex mode=sed field=_raw "s/((?=&amp;lt;[^&amp;gt;]&amp;gt;)[^;]+;[^;]+;|&amp;lt;[^&amp;gt;]&amp;gt;|&amp;lt;\/[^&amp;gt;]+&amp;gt;|&amp;lt;[^'"]+['"]|['"][^&amp;lt;]+&amp;lt;[^&amp;gt;]+&amp;gt;)//g"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;you can change the field=_raw to another field name if you have already extracted this text into another field (optional)&lt;/P&gt;</description>
      <pubDate>Sat, 18 Aug 2018 06:42:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411943#M118786</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2018-08-18T06:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help me with regex to remove HTML tags from fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411944#M118787</link>
      <description>&lt;P&gt;unfortunately I had to delete the "KB43... " as well... as it would stick to the URL. Therefore making the URL invalid.&lt;/P&gt;

&lt;P&gt;If you really need that "KB43..." value then hit me up again. &lt;/P&gt;</description>
      <pubDate>Sat, 18 Aug 2018 06:49:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411944#M118787</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2018-08-18T06:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help me with regex to remove HTML tags from fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411945#M118788</link>
      <description>&lt;P&gt;Thank you for spending the time!  I don't need the KB values, but when I put the SPL command in, I get this error:  Mismatched ']'.  I see that the regex works, but can't figure out why Splunk complains about it.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Aug 2018 20:57:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411945#M118788</guid>
      <dc:creator>ndsouza25</dc:creator>
      <dc:date>2018-08-18T20:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help me with regex to remove HTML tags from fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411946#M118789</link>
      <description>&lt;P&gt;@ndsouza25 you are right, I fixed it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex mode=sed field=_raw "s/((?=&amp;lt;[^&amp;gt;]&amp;gt;)[^;]+;[^;]+;|&amp;lt;[^&amp;gt;]&amp;gt;|&amp;lt;\/[^&amp;gt;]+&amp;gt;|&amp;lt;[^\'\"]+[\'\"]|[\'\"][^&amp;lt;]+&amp;lt;[^&amp;gt;]+&amp;gt;)//g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem was that I needed to escape &lt;CODE&gt;"&lt;/CODE&gt; characters, as they interfere with the engine &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Works now, tested it in splunk.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Aug 2018 00:08:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411946#M118789</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2018-08-19T00:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can someone help me with regex to remove HTML tags from fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411947#M118790</link>
      <description>&lt;P&gt;It works perfectly, thank you very much pyro_wood! &lt;/P&gt;</description>
      <pubDate>Sun, 19 Aug 2018 07:13:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-someone-help-me-with-regex-to-remove-HTML-tags-from-fields/m-p/411947#M118790</guid>
      <dc:creator>ndsouza25</dc:creator>
      <dc:date>2018-08-19T07:13:44Z</dc:date>
    </item>
  </channel>
</rss>

