<?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 all possible special characters in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656085#M226607</link>
    <description>&lt;P&gt;Hi Splunk Experts,&lt;/P&gt;&lt;P&gt;I've a table and based on a click, I'm holding the value of field in token and using it in a different panel with search command. If there are any special characters the search is getting failed. I've tried replacing it with '*', but that gives me unexpected results. So I'm thinking of escaping all possible special characters in the token value. Please advice!!&lt;BR /&gt;&lt;BR /&gt;Ex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;!@#$%^&amp;amp;*(){}|";:&amp;lt;&amp;gt;/\[]&lt;/LI-CODE&gt;&lt;P&gt;I want them as below:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\!\@\#\$\%\^\&amp;amp;\*\(\)\{\}\|\"\;\:\&amp;lt;\&amp;gt;\/\\\[\]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Aug 2023 10:28:17 GMT</pubDate>
    <dc:creator>Thulasinathan_M</dc:creator>
    <dc:date>2023-08-30T10:28:17Z</dc:date>
    <item>
      <title>How to escape all possible special characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656085#M226607</link>
      <description>&lt;P&gt;Hi Splunk Experts,&lt;/P&gt;&lt;P&gt;I've a table and based on a click, I'm holding the value of field in token and using it in a different panel with search command. If there are any special characters the search is getting failed. I've tried replacing it with '*', but that gives me unexpected results. So I'm thinking of escaping all possible special characters in the token value. Please advice!!&lt;BR /&gt;&lt;BR /&gt;Ex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;!@#$%^&amp;amp;*(){}|";:&amp;lt;&amp;gt;/\[]&lt;/LI-CODE&gt;&lt;P&gt;I want them as below:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;\!\@\#\$\%\^\&amp;amp;\*\(\)\{\}\|\"\;\:\&amp;lt;\&amp;gt;\/\\\[\]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 10:28:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656085#M226607</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-08-30T10:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape all possible special characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656086#M226608</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/253572"&gt;@Thulasinathan_M&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if you always have a special char in the beginning of the token, you could add a backslash "\" as prefix to the token.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 10:30:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656086#M226608</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-08-30T10:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape all possible special characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656092#M226609</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;, It can be anywhere in the text.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 11:31:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656092#M226609</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-08-30T11:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape all possible special characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656094#M226610</link>
      <description>&lt;P&gt;You could try replacing every special character with a backslash followed by that character.&lt;/P&gt;&lt;P&gt;In the following example, the token used in the title is set when the field is clicked. The token value is the contents of the second multi-value in the field, which has been hidden using CSS. (I tried using the replace in the token evaluation directly but it only seems to work on a field not a string.)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    &amp;lt;panel depends="$alwayshide$"&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;style&amp;gt;
          #escaped table tbody td div.multivalue-subcell[data-mv-index="1"] {
            display: none;
          }
        &amp;lt;/style&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
    &amp;lt;panel id="escaped"&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;title&amp;gt;$escaped$&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
| fields - _time
| eval param="!@#$%^&amp;amp;amp;*(){}|\";:&amp;amp;lt;&amp;amp;gt;/\\[]"
| eval param=mvappend(param,replace(param,"([!@#$%^&amp;amp;amp;*\(\)\{\}\|\";:&amp;amp;lt;&amp;amp;gt;\/\\\[\]])","\\\\\1"))&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;cell&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;drilldown&amp;gt;
          &amp;lt;eval token="escaped"&amp;gt;mvindex($click.value$,1)&amp;lt;/eval&amp;gt;
        &amp;lt;/drilldown&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 11:45:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656094#M226610</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-30T11:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape all possible special characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656105#M226611</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;. This is exactly what I'm looking for, but my text comes from a token. If I do something like below, I get "&lt;SPAN&gt;&amp;nbsp;Error in 'SearchParser': Mismatched ']'.&lt;/SPAN&gt;"&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;init&amp;gt;
    &amp;lt;eval token="input"&amp;gt;"!@#$%^&amp;amp;amp;*(){}|\";:&amp;amp;lt;&amp;amp;gt;/\\[]"&amp;lt;/eval&amp;gt;
  &amp;lt;/init&amp;gt;
   &amp;lt;row&amp;gt;
   &amp;lt;panel depends="$alwayshide$"&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;style&amp;gt;
          #escaped table tbody td div.multivalue-subcell[data-mv-index="1"] {
            display: none;
          }
        &amp;lt;/style&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
    &amp;lt;panel id="escaped"&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;title&amp;gt;$escaped$&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
| fields - _time
| eval param="$input$"
| eval param=mvappend(param,replace(param,"([!@#$%^&amp;amp;amp;*\(\)\{\}\|\";:&amp;amp;lt;&amp;amp;gt;\/\\\[\]])","\\\\\1"))&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;cell&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;drilldown&amp;gt;
          &amp;lt;eval token="escaped"&amp;gt;mvindex($click.value$,1)&amp;lt;/eval&amp;gt;
        &amp;lt;/drilldown&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
     &amp;lt;/row&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 13:17:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656105#M226611</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-08-30T13:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape all possible special characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656112#M226614</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  &amp;lt;init&amp;gt;
    &amp;lt;set token="input"&amp;gt;!@#$%^&amp;amp;amp;*(){}|\";:&amp;amp;lt;&amp;amp;gt;/\\[]&amp;lt;/set&amp;gt;
  &amp;lt;/init&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel depends="$alwayshide$"&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;style&amp;gt;
          #escaped table tbody td div.multivalue-subcell[data-mv-index="1"] {
            display: none;
          }
        &amp;lt;/style&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
    &amp;lt;panel id="escaped"&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;title&amp;gt;$escaped$&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
| fields - _time
| eval param=$input|s$
| eval param=mvappend(param,replace(param,"([!@#$%^&amp;amp;amp;*\(\)\{\}\|\";:&amp;amp;lt;&amp;amp;gt;\/\\\[\]])","\\\\\1"))&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;cell&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;drilldown&amp;gt;
          &amp;lt;eval token="escaped"&amp;gt;mvindex($click.value$,1)&amp;lt;/eval&amp;gt;
        &amp;lt;/drilldown&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 30 Aug 2023 13:52:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656112#M226614</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-08-30T13:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to escape all possible special characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656130#M226620</link>
      <description>&lt;P&gt;Thanks, worked perfectly.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 16:10:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-escape-all-possible-special-characters/m-p/656130#M226620</guid>
      <dc:creator>Thulasinathan_M</dc:creator>
      <dc:date>2023-08-30T16:10:28Z</dc:date>
    </item>
  </channel>
</rss>

