<?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 use Regex inside a Case statement in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634748#M220523</link>
    <description>&lt;P&gt;Please check that you have copied it correctly because this has been copied directly from a valid search&lt;/P&gt;</description>
    <pubDate>Thu, 16 Mar 2023 09:36:24 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-03-16T09:36:24Z</dc:date>
    <item>
      <title>How to use Regex inside a Case statement?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634737#M220516</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;How can i write this statement&lt;BR /&gt;&lt;BR /&gt;| eval protocolUsed = case( regex consumerkey="[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}","O1",&lt;BR /&gt;regex consumerkey="^[a-z0-9A-Z]{2,}$", "O2"))&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 19:09:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634737#M220516</guid>
      <dc:creator>amitrinx</dc:creator>
      <dc:date>2023-03-16T19:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Regex inside a Case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634739#M220517</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;What issue you are trying to solve?&lt;/P&gt;&lt;P&gt;regex command select rows which are matching it and drop others. So you cannot use it like this.&lt;/P&gt;&lt;P&gt;If you want to pick part of event to a new field then you should use rex command not regex.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 08:35:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634739#M220517</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-03-16T08:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Regex inside a Case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634740#M220518</link>
      <description>&lt;P&gt;I want to match certain keys and group them as O1 and others set of Keys to O2, and then use the fields&lt;BR /&gt;If i have to use rex field then in that case I should create two fields?&lt;BR /&gt;&lt;BR /&gt;Have you understood?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 08:39:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634740#M220518</guid>
      <dc:creator>amitrinx</dc:creator>
      <dc:date>2023-03-16T08:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Regex inside a Case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634741#M220519</link>
      <description>&lt;P&gt;Yes I think that this is the easiest way to do it. Later you can use e.g. coalesce to select which value you have in current event. Or use case with isnull/isnotnull conditions.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 08:43:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634741#M220519</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-03-16T08:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Regex inside a Case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634744#M220520</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval protocolUsed = case(match(consumerKey,"[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}"),"O1", match(consumerKey,"^[a-z0-9A-Z]{2,}$"), "O2")&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 16 Mar 2023 09:13:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634744#M220520</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-03-16T09:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Regex inside a Case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634747#M220522</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I am getting Error in 'EvalCommand': The expression is malformed. Expected ).&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 09:32:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634747#M220522</guid>
      <dc:creator>amitrinx</dc:creator>
      <dc:date>2023-03-16T09:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Regex inside a Case statement</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634748#M220523</link>
      <description>&lt;P&gt;Please check that you have copied it correctly because this has been copied directly from a valid search&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 09:36:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-inside-a-Case-statement/m-p/634748#M220523</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-03-16T09:36:24Z</dc:date>
    </item>
  </channel>
</rss>

