<?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: How to match() End of Line in a token query? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-match-End-of-Line-in-a-token-query/m-p/584389#M47913</link>
    <description>&lt;P&gt;What I ended up doing as a workaround:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;index="data"&lt;BR /&gt;| eval foo_state=if(match(foo, "^($foo_token$)$"), 1, 0)&lt;BR /&gt;| eval bar_state=if(match(bar, "^($bar_token$)$"), 1, 0)&lt;BR /&gt;| eval state=if(foo_state=1, if(bar_state=1, 1, 0), if(bar_state=0, 2, 0))&lt;/PRE&gt;</description>
    <pubDate>Wed, 09 Feb 2022 22:05:27 GMT</pubDate>
    <dc:creator>pbarna</dc:creator>
    <dc:date>2022-02-09T22:05:27Z</dc:date>
    <item>
      <title>How to match() End of Line in a token query?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-match-End-of-Line-in-a-token-query/m-p/584337#M47907</link>
      <description>&lt;P&gt;Follow-on from my&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Splunk-Search/Find-records-which-both-do-and-do-not-match-user-search-criteria/m-p/583747#M203280" target="_blank" rel="noopener"&gt;previous question&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;I ended up using a slightly different solution involving&amp;nbsp; &lt;FONT face="courier new,courier"&gt;match&lt;/FONT&gt; for the &lt;FONT face="courier new,courier"&gt;case&lt;/FONT&gt; criteria. Since the query inputs are being provided by token values to a Splunk Studio dashboard, I would not be able to properly break up and quote each term of a multi-value text input. By using &lt;FONT face="courier new,courier"&gt;match&lt;/FONT&gt;, I can just tell users to use &lt;FONT face="courier new,courier"&gt;|&lt;/FONT&gt; as a separator instead and run a search like:&lt;/P&gt;
&lt;PRE&gt;| eval state=case(match(foo, "^($foo_token$)$") AND match(bar, "^($bar_token$)$"), 1, NOT match(foo, "^($foo_token$)$") AND NOT match(bar, "^($bar_token$)$"), 2, 1=1, 0)&lt;/PRE&gt;
&lt;P&gt;However, the table cannot run this search. Even if both &lt;FONT face="courier new,courier"&gt;foo&lt;/FONT&gt;&amp;nbsp;and &lt;FONT face="courier new,courier"&gt;bar&lt;/FONT&gt; have input values, the table shows "Waiting for input."&lt;BR /&gt;If I escape the end-of-line match character like &lt;FONT face="courier new,courier"&gt;$$&lt;/FONT&gt;&amp;nbsp;or like &lt;FONT face="courier new,courier"&gt;\$&lt;/FONT&gt;, I see the same "Waiting for input."&lt;BR /&gt;If I use only:&lt;/P&gt;
&lt;PRE&gt;| eval state=case(match(foo, "^($foo_token$)$"), 1, 1=1, 0)&lt;/PRE&gt;
&lt;P&gt;The search runs and produces expected results, so it seems to be a problem with having 2 or more &lt;FONT face="courier new,courier"&gt;$&lt;/FONT&gt;s.&lt;/P&gt;
&lt;P&gt;I want to search for whole-line values of fields only. How can I do this?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 19:49:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-match-End-of-Line-in-a-token-query/m-p/584337#M47907</guid>
      <dc:creator>pbarna</dc:creator>
      <dc:date>2022-02-09T19:49:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to match() End of Line in a token query?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-match-End-of-Line-in-a-token-query/m-p/584389#M47913</link>
      <description>&lt;P&gt;What I ended up doing as a workaround:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;index="data"&lt;BR /&gt;| eval foo_state=if(match(foo, "^($foo_token$)$"), 1, 0)&lt;BR /&gt;| eval bar_state=if(match(bar, "^($bar_token$)$"), 1, 0)&lt;BR /&gt;| eval state=if(foo_state=1, if(bar_state=1, 1, 0), if(bar_state=0, 2, 0))&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Feb 2022 22:05:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-match-End-of-Line-in-a-token-query/m-p/584389#M47913</guid>
      <dc:creator>pbarna</dc:creator>
      <dc:date>2022-02-09T22:05:27Z</dc:date>
    </item>
  </channel>
</rss>

