<?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 special characters in text input in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Escaping-special-characters-in-text-input/m-p/541450#M153293</link>
    <description>&lt;P&gt;Try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval switch="$switch|s$"&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 26 Feb 2021 07:26:19 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-02-26T07:26:19Z</dc:date>
    <item>
      <title>Escaping special characters in text input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Escaping-special-characters-in-text-input/m-p/541439#M153290</link>
      <description>&lt;P&gt;I have a very basic dashboard that requires my users to put in text inputs.&amp;nbsp; These inputs are then outputted to a CSV file that can be referenced.&amp;nbsp; The basics of it are&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;input type="text" token="user"&amp;gt;
        &amp;lt;label&amp;gt;user&amp;lt;/label&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;input type="text" token="hostname"&amp;gt;
        &amp;lt;label&amp;gt;Host Name&amp;lt;/label&amp;gt;
&amp;lt;/input&amp;gt;
 &amp;lt;input type="text" token="switch"&amp;gt;
        &amp;lt;label&amp;gt;Switchingcommand&amp;lt;/label&amp;gt;
&amp;lt;/input&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have my form being submitted via a submit button at the top of the form that takes this information and outputs this to a csv file with an append&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;
          | makeresults
          | eval user="$user$"
          | eval hostname="$hostname$"
          | eval switch="$switch$"
          | outputlookup tracking.csv append=true
        &amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above works within the dashboard provided that there are no special characters.&amp;nbsp; Due to the nature of the value for "switch" above, it can contain a long string with various escape characters.&amp;nbsp; For example a string entered could be almost any special characters (for example it could contain "regex" or "#" or "=" or "$" or "[word]" etc. etc. etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried modifying my search query as follows (adding in |s$) after the eval for switch&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;
          | makeresults
          | eval user="$user$"
          | eval hostname="$hostname$"
          | eval switch="$switch$"|s$
          | outputlookup tracking.csv append=true
        &amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;however this doesn't appear to work and the input silently fails.&amp;nbsp; Have I used |s$ in the correct place or is this not possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2021 05:52:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Escaping-special-characters-in-text-input/m-p/541439#M153290</guid>
      <dc:creator>willadams</dc:creator>
      <dc:date>2021-02-26T05:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping special characters in text input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Escaping-special-characters-in-text-input/m-p/541450#M153293</link>
      <description>&lt;P&gt;Try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval switch="$switch|s$"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 26 Feb 2021 07:26:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Escaping-special-characters-in-text-input/m-p/541450#M153293</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-02-26T07:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping special characters in text input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Escaping-special-characters-in-text-input/m-p/675838#M231208</link>
      <description>&lt;P&gt;Can anyone point me to where this escaping is documented in the Splunk manuals?&lt;/P&gt;&lt;P&gt;I can across it in a dashboard today and have not been able to track it down - very confusing until a colleague told me what it did.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 01:54:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Escaping-special-characters-in-text-input/m-p/675838#M231208</guid>
      <dc:creator>KeithH</dc:creator>
      <dc:date>2024-01-30T01:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Escaping special characters in text input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Escaping-special-characters-in-text-input/m-p/675841#M231209</link>
      <description>&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/9.1.1/Viz/tokens#Token_filters" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.1.1/Viz/tokens#Token_filters&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 03:30:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Escaping-special-characters-in-text-input/m-p/675841#M231209</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-01-30T03:30:05Z</dc:date>
    </item>
  </channel>
</rss>

