<?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: How to remove \ (backslash) using from URLs rex sed? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-backslash-using-from-URLs-rex-sed/m-p/529137#M149395</link>
    <description>&lt;P&gt;Over 4 years later and this post still helped me solve my problem! Thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 12 Nov 2020 13:13:42 GMT</pubDate>
    <dc:creator>wolanm1</dc:creator>
    <dc:date>2020-11-12T13:13:42Z</dc:date>
    <item>
      <title>How to remove \ (backslash) using from URLs rex sed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-backslash-using-from-URLs-rex-sed/m-p/201453#M58373</link>
      <description>&lt;P&gt;I am trying to remove the escaped characters of  "\" from the URLs coming in via a Twitter REST feed.  Does anyone have the secret sauce for forming a rex field= mode=sed?&lt;/P&gt;

&lt;P&gt;Sample URL: http:\/\/pbs.twimg.com\/media\/CoyGo5cUsAEmIZF.jpg&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 16:48:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-backslash-using-from-URLs-rex-sed/m-p/201453#M58373</guid>
      <dc:creator>ccsfdave</dc:creator>
      <dc:date>2016-08-01T16:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove \ (backslash) using from URLs rex sed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-backslash-using-from-URLs-rex-sed/m-p/201454#M58374</link>
      <description>&lt;P&gt;This works for me in the search window:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval yourfieldname=replace(yourfieldname,"\\\\(.)","\1")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;EDIT: a few words of explanation... the string &lt;CODE&gt;"\\\\(.)"&lt;/CODE&gt; actually corresponds to the regex &lt;CODE&gt;\\(.)&lt;/CODE&gt; which will match a single backslash followed by any character. The backslash has to be escaped once for the regex and another time to be in a double-quoted string, hence why one becomes four. If you're using the regex in a .conf file, depending how you do it, you don't need to escape it twice. Hope that helps.&lt;/P&gt;

&lt;P&gt;NOTE: the advantage of that approach is that if your raw data has an escaped backslash (i.e. two backslashes in a row), it will do the right thing and replace it with one backslash rather than blindly removing all backslashes.&lt;/P&gt;

&lt;P&gt;NOTE: this is probably also possible using sed.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 16:56:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-backslash-using-from-URLs-rex-sed/m-p/201454#M58374</guid>
      <dc:creator>gabriel_vasseur</dc:creator>
      <dc:date>2016-08-01T16:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove \ (backslash) using from URLs rex sed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-backslash-using-from-URLs-rex-sed/m-p/201455#M58375</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval url="http:\/\/pbs.twimg.com\/media\/CoyGo5cUsAEmIZF.jpg"  | rex mode=sed field=url "s/\\\//g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You may also need to use the urldecode command for some urls (|eval url=urldecode(url)).&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 16:59:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-backslash-using-from-URLs-rex-sed/m-p/201455#M58375</guid>
      <dc:creator>Jeremiah</dc:creator>
      <dc:date>2016-08-01T16:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove \ (backslash) using from URLs rex sed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-backslash-using-from-URLs-rex-sed/m-p/201456#M58376</link>
      <description>&lt;P&gt;This worked as well!  two ways to skin this one!  thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 17:02:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-backslash-using-from-URLs-rex-sed/m-p/201456#M58376</guid>
      <dc:creator>ccsfdave</dc:creator>
      <dc:date>2016-08-01T17:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove \ (backslash) using from URLs rex sed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-backslash-using-from-URLs-rex-sed/m-p/201457#M58377</link>
      <description>&lt;P&gt;this worked, thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 01 Aug 2016 17:02:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-backslash-using-from-URLs-rex-sed/m-p/201457#M58377</guid>
      <dc:creator>ccsfdave</dc:creator>
      <dc:date>2016-08-01T17:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove \ (backslash) using from URLs rex sed?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-remove-backslash-using-from-URLs-rex-sed/m-p/529137#M149395</link>
      <description>&lt;P&gt;Over 4 years later and this post still helped me solve my problem! Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2020 13:13:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-remove-backslash-using-from-URLs-rex-sed/m-p/529137#M149395</guid>
      <dc:creator>wolanm1</dc:creator>
      <dc:date>2020-11-12T13:13:42Z</dc:date>
    </item>
  </channel>
</rss>

