<?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: Escaping a forward slash / in conditional statement in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302885#M165710</link>
    <description>&lt;P&gt;You should not need to escape anything other than a double quote within a string. Are you sure your Reason field contains &lt;STRONG&gt;exactly&lt;/STRONG&gt; the string value you are evaluating in your case statement (extra spaces, tab characters, etc.)?&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="I have no issues with proper evaluation, if the string matches."&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3652i927D1B731719BA69/image-size/large?v=v2&amp;amp;px=999" role="button" title="I have no issues with proper evaluation, if the string matches." alt="I have no issues with proper evaluation, if the string matches." /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Oct 2017 19:28:00 GMT</pubDate>
    <dc:creator>s2_splunk</dc:creator>
    <dc:date>2017-10-10T19:28:00Z</dc:date>
    <item>
      <title>Escaping a forward slash / in conditional statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302883#M165708</link>
      <description>&lt;P&gt;I have a conditional statement (part of an eval case) in which I need to check for the value of a field. The desired value contains a forward slash ( &lt;CODE&gt;/&lt;/CODE&gt;).&lt;BR /&gt;
&lt;CODE&gt;| eval Bool = case(Reason=="Thing1 / Thing2", 0, ... 1=1, 1)&lt;/CODE&gt;. This statement will evaluate to  &lt;CODE&gt;Bool = 1&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I've tried to escape it with a back slash ( &lt;CODE&gt;/&lt;/CODE&gt;), but that didn't work.&lt;BR /&gt;
&lt;CODE&gt;| eval Bool = case(Reason=="Thing1 \/ Thing2", 0, ... 1=1, 1)&lt;/CODE&gt;. This still evaluates to  &lt;CODE&gt;Bool = 1&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;I can technically use a  &lt;CODE&gt;like&lt;/CODE&gt; statement, which is how I know the  &lt;CODE&gt;/&lt;/CODE&gt; is causing the issue.&lt;BR /&gt;
&lt;CODE&gt;| eval Bool = case(Reason like "Thing1 % Thing2", 0, ... 1=1, 1)&lt;/CODE&gt;. This evaluates to  &lt;CODE&gt;Bool = 0&lt;/CODE&gt;.&lt;BR /&gt;
&lt;CODE&gt;| eval Bool = case(Reason like "Thing1%Thing2", 0, ... 1=1, 1)&lt;/CODE&gt;. This evaluates to  &lt;CODE&gt;Bool = 0&lt;/CODE&gt;. (The only difference is no spaces around the  &lt;CODE&gt;%&lt;/CODE&gt; character.)&lt;/P&gt;

&lt;P&gt;Is there a solution that will let me use an exact match search vs. the like statement?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 19:16:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302883#M165708</guid>
      <dc:creator>mstark31</dc:creator>
      <dc:date>2017-10-10T19:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping a forward slash / in conditional statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302884#M165709</link>
      <description>&lt;P&gt;Hi mstark31,&lt;/P&gt;

&lt;P&gt;What version are you on? Because this works just fine on 6.6.3 using this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval Reason="Thing1 / Thing2" 
| eval Bool = case(Reason=="Thing1 / Thing2", 0, 1=1, 1) 
| eval Bool2 = case(Reason=="Thing2 / Thing2", 0, 1=1, 1)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3651i402055E21003CFBF/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 19:26:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302884#M165709</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2017-10-10T19:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping a forward slash / in conditional statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302885#M165710</link>
      <description>&lt;P&gt;You should not need to escape anything other than a double quote within a string. Are you sure your Reason field contains &lt;STRONG&gt;exactly&lt;/STRONG&gt; the string value you are evaluating in your case statement (extra spaces, tab characters, etc.)?&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="I have no issues with proper evaluation, if the string matches."&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3652i927D1B731719BA69/image-size/large?v=v2&amp;amp;px=999" role="button" title="I have no issues with proper evaluation, if the string matches." alt="I have no issues with proper evaluation, if the string matches." /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 19:28:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302885#M165710</guid>
      <dc:creator>s2_splunk</dc:creator>
      <dc:date>2017-10-10T19:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping a forward slash / in conditional statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302886#M165711</link>
      <description>&lt;P&gt;@mstark31&lt;/P&gt;

&lt;P&gt;check this,&lt;/P&gt;

&lt;P&gt;| makeresults | eval test="Thing1 / Thing2"  | eval test1 = case(test=="Thing1 / Thing2","One",test!="Thing1 / Thing2","Two") |  eval test2 = case(test="Thing1 \/ Thing2","one",test!="Thing1 \/ Thing2","TWO")&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 19:28:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302886#M165711</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2017-10-10T19:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping a forward slash / in conditional statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302887#M165712</link>
      <description>&lt;P&gt;I am in 6.6.2.&lt;/P&gt;

&lt;P&gt;I tried your search, and it does exactly what yours does (basically, works).&lt;/P&gt;

&lt;P&gt;I had to abstract things for the search I shared in my question, but my original search still doesn't function properly. I am in the process of making sure I'm not missing anything else.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 20:29:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302887#M165712</guid>
      <dc:creator>mstark31</dc:creator>
      <dc:date>2017-10-10T20:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping a forward slash / in conditional statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302888#M165713</link>
      <description>&lt;P&gt;Thank you for helping with my debugging process. Despite the fact that I was copying and pasting the value for Reason from my data table, there was another space in there causing the problem. I went back to our original database that is sending to Splunk and found the space.&lt;/P&gt;

&lt;P&gt;I feel silly, but at least I was able to rule out the need to escape the forward /. &lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 20:39:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302888#M165713</guid>
      <dc:creator>mstark31</dc:creator>
      <dc:date>2017-10-10T20:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping a forward slash / in conditional statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302889#M165714</link>
      <description>&lt;P&gt;He/She who has never overlooked a space throw the first rock! &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
Glad you got it figured out; and thanks for closing the loop by providing (re)solution and accepting answer!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2017 20:46:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Escaping-a-forward-slash-in-conditional-statement/m-p/302889#M165714</guid>
      <dc:creator>s2_splunk</dc:creator>
      <dc:date>2017-10-10T20:46:52Z</dc:date>
    </item>
  </channel>
</rss>

