<?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: Regex If Statement Help in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118624#M31691</link>
    <description>&lt;P&gt;I don't understand exactly what you need but surely it is something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=Name "(?i)pvms(?&amp;lt;Physical_Host_Type&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 20 May 2015 21:10:11 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2015-05-20T21:10:11Z</dc:date>
    <item>
      <title>Regex If Statement Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118623#M31690</link>
      <description>&lt;P&gt;This field is called 'Name' and contains around 10000 sever names, I am trying to use an eval formula to create a column to identify the vpvms of the following server name nadcvpvms04b.hca.corpad.net&lt;BR /&gt;&lt;BR /&gt;
I am a very new Splunk user I have tried everything and for the life of me can not get this to work and I am sure it is something easy.&lt;BR /&gt;
This is what I have so far&lt;/P&gt;

&lt;P&gt;The case statement I tried&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Physical Host Type=case(match(Name,"(?i)\p{Ll}vpvms"),"ESX Host")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and the if statement I tried&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Physical Host Type=if(match(Name,"(?i)\p{Ll}vpvms"),"ESX Host","")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 May 2015 21:04:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118623#M31690</guid>
      <dc:creator>jhayIV</dc:creator>
      <dc:date>2015-05-20T21:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Regex If Statement Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118624#M31691</link>
      <description>&lt;P&gt;I don't understand exactly what you need but surely it is something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=Name "(?i)pvms(?&amp;lt;Physical_Host_Type&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 May 2015 21:10:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118624#M31691</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-20T21:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Regex If Statement Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118625#M31692</link>
      <description>&lt;P&gt;I think it is easier then you think.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval Physical_Host_Type = case(match(Name,"(?i)vpvms"),"ESX Host",1==1,"None")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is better for two reasons: Field names should NOT have spaces in them, it can be done, just not recommended. And the "1==1" is your always true statement, so you can filter out those that don't match later on. I have tested this on a different pattern, and it worked.&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 21:17:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118625#M31692</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-05-20T21:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Regex If Statement Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118626#M31693</link>
      <description>&lt;P&gt;That is not even a valid command. Please revise.&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 21:18:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118626#M31693</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2015-05-20T21:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Regex If Statement Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118627#M31694</link>
      <description>&lt;P&gt;Sorry, skip the &lt;CODE&gt;eval&lt;/CODE&gt;!&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 21:21:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118627#M31694</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-05-20T21:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: Regex If Statement Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118628#M31695</link>
      <description>&lt;P&gt;It will be better to give exact answer if you provide 1 or 2 lines of logs.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2015 21:52:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118628#M31695</guid>
      <dc:creator>regexcracker</dc:creator>
      <dc:date>2015-05-20T21:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Regex If Statement Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118629#M31696</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/3514"&gt;@alacercogitatus&lt;/a&gt; I tried your statement with no luck, I have provided a table of the data below. Those CI Names with vpvms I would like to have ESX show up in the Physical_Host_Type&lt;/P&gt;

&lt;P&gt;CI Name                         Physical_Host_Type&lt;BR /&gt;
ordcwpdbsaasc1b None&lt;BR /&gt;
ordcvzvms01f            None&lt;BR /&gt;
ordcvpvms02c             None&lt;BR /&gt;
ordcvzvms01d               None&lt;BR /&gt;
nadcvpvms03a             None&lt;/P&gt;

&lt;P&gt;I appreciate the help&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:59:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118629#M31696</guid>
      <dc:creator>jhayIV</dc:creator>
      <dc:date>2020-09-28T19:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Regex If Statement Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118630#M31697</link>
      <description>&lt;P&gt;Based on your table there, is your field actually called &lt;CODE&gt;Name&lt;/CODE&gt; or is it actually &lt;CODE&gt;'CI Name'&lt;/CODE&gt; ?&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2015 04:31:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118630#M31697</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-05-21T04:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Regex If Statement Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118631#M31698</link>
      <description>&lt;P&gt;@acharlieh Field Name is 'Name' Sorry about that&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2015 18:59:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-If-Statement-Help/m-p/118631#M31698</guid>
      <dc:creator>jhayIV</dc:creator>
      <dc:date>2015-05-21T18:59:35Z</dc:date>
    </item>
  </channel>
</rss>

