<?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 How to escape double backslash in rex/regex command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-double-backslash-in-rex-regex-command/m-p/444410#M126031</link>
    <description>&lt;P&gt;I'm having some serious difficulty in figuring out how to escape a double backslash within the REX/regex spl command..&lt;BR /&gt;
The following regex works on regex101 &lt;CODE&gt;"title\\\\\"\:\\\\\"(?&amp;lt;event&amp;gt;[^\)].*)\\\\\"\,\\\\\"selection"&lt;/CODE&gt; when extracting the log snippet below to get the "Button Title" text: &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;"partyId\":\"lahflkhasdljkflkf\",\"title\”:\”Button Title\”,\”selectionType\":\"button\&lt;BR /&gt;
I found a suggestion on "Tricky behavior of escaping backslash in regex" to \\ to match a single \ but that didn't do the trick. Anyone have advice on how to escape a double backslash in the rex command, and if so please post the regex below!&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 05 Sep 2018 22:33:12 GMT</pubDate>
    <dc:creator>ixixix_spl</dc:creator>
    <dc:date>2018-09-05T22:33:12Z</dc:date>
    <item>
      <title>How to escape double backslash in rex/regex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-double-backslash-in-rex-regex-command/m-p/444410#M126031</link>
      <description>&lt;P&gt;I'm having some serious difficulty in figuring out how to escape a double backslash within the REX/regex spl command..&lt;BR /&gt;
The following regex works on regex101 &lt;CODE&gt;"title\\\\\"\:\\\\\"(?&amp;lt;event&amp;gt;[^\)].*)\\\\\"\,\\\\\"selection"&lt;/CODE&gt; when extracting the log snippet below to get the "Button Title" text: &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;"partyId\":\"lahflkhasdljkflkf\",\"title\”:\”Button Title\”,\”selectionType\":\"button\&lt;BR /&gt;
I found a suggestion on "Tricky behavior of escaping backslash in regex" to \\ to match a single \ but that didn't do the trick. Anyone have advice on how to escape a double backslash in the rex command, and if so please post the regex below!&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 22:33:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-double-backslash-in-rex-regex-command/m-p/444410#M126031</guid>
      <dc:creator>ixixix_spl</dc:creator>
      <dc:date>2018-09-05T22:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape double backslash in rex/regex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-double-backslash-in-rex-regex-command/m-p/444411#M126032</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I would use &lt;CODE&gt;\W - Matches any non-word character&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Append this &lt;CODE&gt;...| rex field=_raw "title\W+(?&amp;lt;event&amp;gt;[\w\s]+)&lt;/CODE&gt; to your search and let me know if it works. &lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 22:49:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-double-backslash-in-rex-regex-command/m-p/444411#M126032</guid>
      <dc:creator>sudosplunk</dc:creator>
      <dc:date>2018-09-05T22:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape double backslash in rex/regex command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-double-backslash-in-rex-regex-command/m-p/444412#M126033</link>
      <description>&lt;P&gt;wow that was quick thanks!!!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 22:51:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-double-backslash-in-rex-regex-command/m-p/444412#M126033</guid>
      <dc:creator>ixixix_spl</dc:creator>
      <dc:date>2018-09-05T22:51:41Z</dc:date>
    </item>
  </channel>
</rss>

