<?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 Help! in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114636#M30335</link>
    <description>&lt;P&gt;Hi shri_27,&lt;/P&gt;

&lt;P&gt;if your data always looks like this one line example and your needed value is always at the last/3rd place like in the one line example, you can use something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "(.+&amp;gt;){2}(?&amp;lt;myValue&amp;gt;.+)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this will give you &lt;CODE&gt;myValue=value3&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
    <pubDate>Tue, 01 Apr 2014 11:21:09 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2014-04-01T11:21:09Z</dc:date>
    <item>
      <title>Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114635#M30334</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I have a field whose values look like value1&amp;gt;value2&amp;gt;value3!!&lt;/P&gt;

&lt;P&gt;Now i want to extract only value3 using rex!&lt;/P&gt;

&lt;P&gt;I am not getting how to do that, Please help!&lt;/P&gt;

&lt;P&gt;Thanks in advance:-)&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2014 11:09:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114635#M30334</guid>
      <dc:creator>shri_27</dc:creator>
      <dc:date>2014-04-01T11:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114636#M30335</link>
      <description>&lt;P&gt;Hi shri_27,&lt;/P&gt;

&lt;P&gt;if your data always looks like this one line example and your needed value is always at the last/3rd place like in the one line example, you can use something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "(.+&amp;gt;){2}(?&amp;lt;myValue&amp;gt;.+)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this will give you &lt;CODE&gt;myValue=value3&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2014 11:21:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114636#M30335</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-04-01T11:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114637#M30336</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "((\w|\s)+\&amp;gt;){2}\s(?&amp;lt;value3&amp;gt;(\w|\s)+)" |...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It would be good to have some real examples, to see what pattern should we look for, but this may work.&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;

&lt;P&gt;EDIT: Updated rex&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2014 11:22:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114637#M30336</guid>
      <dc:creator>gfuente</dc:creator>
      <dc:date>2014-04-01T11:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114638#M30337</link>
      <description>&lt;P&gt;System Campus &amp;gt; Common Domain &amp;gt; Common Domain Park&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2014 11:33:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114638#M30337</guid>
      <dc:creator>shri_27</dc:creator>
      <dc:date>2014-04-01T11:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114639#M30338</link>
      <description>&lt;P&gt;real value above! Not able to extract value3 from both the rex expressions&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2014 11:35:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114639#M30338</guid>
      <dc:creator>shri_27</dc:creator>
      <dc:date>2014-04-01T11:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114640#M30339</link>
      <description>&lt;P&gt;i want to extract only Common Domain Park&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2014 11:36:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114640#M30339</guid>
      <dc:creator>shri_27</dc:creator>
      <dc:date>2014-04-01T11:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114641#M30340</link>
      <description>&lt;P&gt;It is because of the white spaces, let me update the regex&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2014 11:36:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114641#M30340</guid>
      <dc:creator>gfuente</dc:creator>
      <dc:date>2014-04-01T11:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114642#M30341</link>
      <description>&lt;P&gt;That worked:-) Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2014 11:53:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114642#M30341</guid>
      <dc:creator>shri_27</dc:creator>
      <dc:date>2014-04-01T11:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114643#M30342</link>
      <description>&lt;P&gt;Olympic_foh_Main-Stadium &amp;gt; Main-Stadium Concession &amp;gt; Concession Areas&lt;/P&gt;

&lt;P&gt;surprisingly am not able to extract 3rd value for this example!!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:17:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114643#M30342</guid>
      <dc:creator>shri_27</dc:creator>
      <dc:date>2020-09-28T16:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114644#M30343</link>
      <description>&lt;P&gt;Got it!! Need to add |- between \w|\s..&lt;BR /&gt;
Thanks again:-)&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2014 12:17:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114644#M30343</guid>
      <dc:creator>shri_27</dc:creator>
      <dc:date>2014-04-01T12:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114645#M30344</link>
      <description>&lt;P&gt;While that regex works, you might want to try improving it a little so it performs a bit better.&lt;/P&gt;

&lt;P&gt;E.g. consider&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(\w|\s)+
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;vs.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[\w\s]+
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you discovered, the hyphen messes things up a little. You may want to try something such as the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?:[^&amp;gt;]+&amp;gt;){2}\s*(?&amp;lt;value3&amp;gt;.+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If there are any characters after the value3 field, then you may want to use that to anchor the end of the extraction. Something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?:[^&amp;gt;]+&amp;gt;){2}\s*(?&amp;lt;value3&amp;gt;.+)\b
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Should help.&lt;/P&gt;

&lt;P&gt;If value3 is always at the end of the string, something very simple such as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.*&amp;gt;\s(?&amp;lt;value3&amp;gt;.+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Will work very well.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Apr 2014 06:28:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114645#M30344</guid>
      <dc:creator>Rob</dc:creator>
      <dc:date>2014-04-02T06:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114646#M30345</link>
      <description>&lt;P&gt;Another option (if the 3rd value is always at the end of the record):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;value3&amp;gt;[^\&amp;gt;]+)(?=$)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Apr 2014 06:24:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114646#M30345</guid>
      <dc:creator>sbrant_splunk</dc:creator>
      <dc:date>2014-04-04T06:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114647#M30346</link>
      <description>&lt;P&gt;This will get the last value:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex "&amp;gt;(?&amp;lt;lastvalue&amp;gt;[^&amp;gt;]+?)!!$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Apr 2014 22:36:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Help/m-p/114647#M30346</guid>
      <dc:creator>vqd361</dc:creator>
      <dc:date>2014-04-08T22:36:27Z</dc:date>
    </item>
  </channel>
</rss>

