<?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: Replace string in text input before search in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/297680#M18833</link>
    <description>&lt;P&gt;Assuming that your input sets a token called &lt;CODE&gt;mac_address_token1&lt;/CODE&gt;, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="text" token="mac_address_token1"&amp;gt;
...
    &amp;lt;change&amp;gt;
        &amp;lt;eval token="mac_address_token2"&amp;gt;replace($mac_address_token1$,":","-")&amp;lt;/eval&amp;gt;     
    &amp;lt;/change&amp;gt;
&amp;lt;/intput&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then use &lt;CODE&gt;$mac_address_token2$&lt;/CODE&gt; inside of your search&lt;/P&gt;</description>
    <pubDate>Wed, 29 Mar 2017 18:27:45 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-03-29T18:27:45Z</dc:date>
    <item>
      <title>How to replace string in text input before search?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/297677#M18830</link>
      <description>&lt;P&gt;I have a simple form where a user inputs a MAC address in the format &lt;STRONG&gt;AA:BB:CC:DD:EE:FF&lt;/STRONG&gt;. But the field that I'm going to search contains MAC addresses in a different format: &lt;STRONG&gt;AA-BB-CC-DD-EE-FF&lt;/STRONG&gt;. So what I need to do is replace semicolons with hyphens in the value of the token &lt;EM&gt;before&lt;/EM&gt; I perform the search. The &lt;STRONG&gt;eval&lt;/STRONG&gt; statement is simple enough:&lt;BR /&gt;&lt;CODE&gt;| eval mac_address=replace("AA:BB:CC:DD:EE:FF",":","-")&lt;/CODE&gt;&lt;BR /&gt;But it's not clear to me if I can do this eval with form input, or if I need to construct my query to do the replacement before I run the search. But I couldn't make it work either way.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 13:48:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/297677#M18830</guid>
      <dc:creator>_smp_</dc:creator>
      <dc:date>2022-10-03T13:48:19Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string in text input before search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/297678#M18831</link>
      <description>&lt;P&gt;You can have your text input to calculate the new token with formatted value and use the new token in your searches. Like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;....
 &amp;lt;input type="text" token="mac_tok"&amp;gt;
      &amp;lt;label&amp;gt;Specify a log level&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;INFO&amp;lt;/default&amp;gt;
      &amp;lt;change&amp;gt;
         &amp;lt;eval token="mac_formatted"&amp;gt;replace("$value$",":","-")&amp;lt;/eval&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
....
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Mar 2017 17:51:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/297678#M18831</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-29T17:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string in text input before search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/297679#M18832</link>
      <description>&lt;P&gt;Yes, that was the trick! I will need to study the &lt;CODE&gt;&amp;lt;change&amp;gt;&lt;/CODE&gt; event handler doc. Thanks so much!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 18:21:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/297679#M18832</guid>
      <dc:creator>_smp_</dc:creator>
      <dc:date>2017-03-29T18:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string in text input before search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/297680#M18833</link>
      <description>&lt;P&gt;Assuming that your input sets a token called &lt;CODE&gt;mac_address_token1&lt;/CODE&gt;, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="text" token="mac_address_token1"&amp;gt;
...
    &amp;lt;change&amp;gt;
        &amp;lt;eval token="mac_address_token2"&amp;gt;replace($mac_address_token1$,":","-")&amp;lt;/eval&amp;gt;     
    &amp;lt;/change&amp;gt;
&amp;lt;/intput&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then use &lt;CODE&gt;$mac_address_token2$&lt;/CODE&gt; inside of your search&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 18:27:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/297680#M18833</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-29T18:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string in text input before search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/297681#M18834</link>
      <description>&lt;P&gt;I am too slow again...&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 18:28:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/297681#M18834</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-29T18:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string in text input before search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/297682#M18835</link>
      <description>&lt;P&gt;Say I want to take in an input as &lt;CODE&gt;index=index source=source filter=$inputfield$&lt;/CODE&gt;, and the input field just has a bunch of labels, but I want to map/replace the labels before the search actually happens, will this work in this case?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 22:56:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/297682#M18835</guid>
      <dc:creator>exocore123</dc:creator>
      <dc:date>2017-06-09T22:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: Replace string in text input before search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/615616#M50537</link>
      <description>&lt;P&gt;hi, pretty old topic, but that was also what I was lookin for.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I had to remove&amp;nbsp; quotes from this part to make it work&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;replace("$value$",&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks!!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2022 08:58:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-replace-string-in-text-input-before-search/m-p/615616#M50537</guid>
      <dc:creator>mr_aksal</dc:creator>
      <dc:date>2022-10-03T08:58:11Z</dc:date>
    </item>
  </channel>
</rss>

