<?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: I am trying to remove all the special characters in the field and replace them with space character using sed mode in rex command. in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/I-am-trying-to-remove-all-the-special-characters-in-the-field/m-p/273709#M52507</link>
    <description>&lt;P&gt;I believe this link has the answer you are looking for.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/139777/rex-mode-sed-diff-between-replace-and-substitute.html"&gt;https://answers.splunk.com/answers/139777/rex-mode-sed-diff-between-replace-and-substitute.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 27 May 2017 18:37:26 GMT</pubDate>
    <dc:creator>mad4wknds</dc:creator>
    <dc:date>2017-05-27T18:37:26Z</dc:date>
    <item>
      <title>I am trying to remove all the special characters in the field and replace them with space character using sed mode in rex command.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/I-am-trying-to-remove-all-the-special-characters-in-the-field/m-p/273704#M52502</link>
      <description>&lt;P&gt;First I tried to search for chars which aren't alphanumeric and replace them with space character.&lt;BR /&gt;
&lt;EM&gt;source="Regex.zip:&lt;/EM&gt;" | rex mode=sed field="Incident Description" "s/[^a-zA-Z0-9]/ /g"*&lt;/P&gt;

&lt;P&gt;This does work fine but when I try the other approach as shown below&lt;/P&gt;

&lt;P&gt;Second approach was to find all the special characters and replace them with space character.&lt;BR /&gt;
&lt;EM&gt;source="Regex.zip:&lt;/EM&gt;" | rex mode=sed field="Incident Description" "s/[!@#$%^&amp;amp;&lt;EM&gt;()-?/{}&amp;lt;|&amp;gt;\:;]/ /g"&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;This does display an error: Error in 'rex' command: Regex: missing terminating ] for character class&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="This the data I was working on"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1616i07BE22DA18FC8F7D/image-size/large?v=v2&amp;amp;px=999" role="button" title="This the data I was working on" alt="This the data I was working on" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 07:38:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/I-am-trying-to-remove-all-the-special-characters-in-the-field/m-p/273704#M52502</guid>
      <dc:creator>anjanikumar</dc:creator>
      <dc:date>2016-07-19T07:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to remove all the special characters in the field and replace them with space character using sed mode in rex command.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/I-am-trying-to-remove-all-the-special-characters-in-the-field/m-p/273705#M52503</link>
      <description>&lt;P&gt;Try escaping the special characters&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex mode=sed "s/\\[\!\@\#\$\%\^\&amp;amp;\(\)\-\?\/\{\}\&amp;lt;\|\&amp;gt;\\\\\:\;]/ /g""
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jul 2016 12:54:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/I-am-trying-to-remove-all-the-special-characters-in-the-field/m-p/273705#M52503</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-19T12:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to remove all the special characters in the field and replace them with space character using sed mode in rex command.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/I-am-trying-to-remove-all-the-special-characters-in-the-field/m-p/273706#M52504</link>
      <description>&lt;P&gt;For completion and in order to avoid complicated syntax I would use the following regex instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex mode=sed "s/\W+/ /g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or if you want to have a more granular control:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex mode=sed "s/[^a-zA-Z0-9_\-\.]+/ /g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jul 2016 13:26:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/I-am-trying-to-remove-all-the-special-characters-in-the-field/m-p/273706#M52504</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-07-19T13:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to remove all the special characters in the field and replace them with space character using sed mode in rex command.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/I-am-trying-to-remove-all-the-special-characters-in-the-field/m-p/273707#M52505</link>
      <description>&lt;P&gt;how to use this during parsing time or props.conf&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 09:54:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/I-am-trying-to-remove-all-the-special-characters-in-the-field/m-p/273707#M52505</guid>
      <dc:creator>neelamsantosh</dc:creator>
      <dc:date>2017-04-19T09:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to remove all the special characters in the field and replace them with space character using sed mode in rex command.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/I-am-trying-to-remove-all-the-special-characters-in-the-field/m-p/273708#M52506</link>
      <description>&lt;P&gt;Take a look at the following &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.2/Data/Anonymizedata"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.2/Data/Anonymizedata&lt;/A&gt; as it'll explain this better than me.&lt;/P&gt;

&lt;P&gt;The concept is the same.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Apr 2017 10:04:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/I-am-trying-to-remove-all-the-special-characters-in-the-field/m-p/273708#M52506</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2017-04-19T10:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: I am trying to remove all the special characters in the field and replace them with space character using sed mode in rex command.</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/I-am-trying-to-remove-all-the-special-characters-in-the-field/m-p/273709#M52507</link>
      <description>&lt;P&gt;I believe this link has the answer you are looking for.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/139777/rex-mode-sed-diff-between-replace-and-substitute.html"&gt;https://answers.splunk.com/answers/139777/rex-mode-sed-diff-between-replace-and-substitute.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 27 May 2017 18:37:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/I-am-trying-to-remove-all-the-special-characters-in-the-field/m-p/273709#M52507</guid>
      <dc:creator>mad4wknds</dc:creator>
      <dc:date>2017-05-27T18:37:26Z</dc:date>
    </item>
  </channel>
</rss>

