<?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 create Splunk Regex to search for a field after n occurrences of comma? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301173#M90682</link>
    <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=indexname|rex ".*,(?&amp;lt;test&amp;gt;\w+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 21 Feb 2018 12:04:10 GMT</pubDate>
    <dc:creator>493669</dc:creator>
    <dc:date>2018-02-21T12:04:10Z</dc:date>
    <item>
      <title>How to create Splunk Regex to search for a field after n occurrences of comma?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301172#M90681</link>
      <description>&lt;P&gt;I have been trying to create Splunk rex but it doesn't work for some reason and would need help in finding any word or string after n number of commas like &lt;/P&gt;

&lt;P&gt;LOG:&lt;BR /&gt;
12/11/2018, abc, def, ced, xyz&lt;/P&gt;

&lt;P&gt;I would like to get variable stored which is after 3 commas which is ced in above case something like :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= | rex ",{3}(?\w+) | table test 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Feb 2018 11:57:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301172#M90681</guid>
      <dc:creator>atulitm</dc:creator>
      <dc:date>2018-02-21T11:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Splunk Regex to search for a field after n occurrences of comma?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301173#M90682</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=indexname|rex ".*,(?&amp;lt;test&amp;gt;\w+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Feb 2018 12:04:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301173#M90682</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-21T12:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Splunk Regex to search for a field after n occurrences of comma?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301174#M90683</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;You can do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex (\s,\s\w+){2}\s,\s(?&amp;lt;fieldname&amp;gt;[^\s]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Put {n-1} for n commas. Here it is {2} for 3 commas.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 12:32:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301174#M90683</guid>
      <dc:creator>ctaf</dc:creator>
      <dc:date>2018-02-21T12:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Splunk Regex to search for a field after n occurrences of comma?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301175#M90684</link>
      <description>&lt;P&gt;Your own attempt comes close, but you of course also need to include the strings before / in between those 3 commas in the regex for it to match.&lt;/P&gt;

&lt;P&gt;So:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= | rex "(?:[^,]*,\s*){3}(?&amp;lt;test&amp;gt;\w+)" | table test
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which defines a non capturing group consisting of some arbitrary number of non-comma characters, followed by a comma and possible whitespace. And that group is repeated 3 times. After that, the actual capturing group to capture the string you need.&lt;BR /&gt;
&lt;A href="https://regex101.com/r/AUhB3o/1"&gt;https://regex101.com/r/AUhB3o/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 12:35:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301175#M90684</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-02-21T12:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Splunk Regex to search for a field after n occurrences of comma?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301176#M90685</link>
      <description>&lt;P&gt;Thanks that helps .. I have tried a lot but may be its simple for you . i would like capture anything after 3rd comma and before 4th because this query helps in getting after 3rd but string after that is having gaps so it doesnt save whole string . &lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 12:56:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301176#M90685</guid>
      <dc:creator>atulitm</dc:creator>
      <dc:date>2018-02-21T12:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Splunk Regex to search for a field after n occurrences of comma?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301177#M90686</link>
      <description>&lt;P&gt;Just replace the \w with [^,] and perhaps you need to do something about not capturing the whitespace before the 4th comma. So try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= | rex "(?:[^,]*,\s*){3}(?&amp;lt;test&amp;gt;[^,]+)\s+," | table test
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/AUhB3o/2"&gt;https://regex101.com/r/AUhB3o/2&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 13:02:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301177#M90686</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-02-21T13:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Splunk Regex to search for a field after n occurrences of comma?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301178#M90687</link>
      <description>&lt;P&gt;Thanks for help frank . I need to improve myself on regex .&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 13:14:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301178#M90687</guid>
      <dc:creator>atulitm</dc:creator>
      <dc:date>2018-02-21T13:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Splunk Regex to search for a field after n occurrences of comma?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301179#M90688</link>
      <description>&lt;P&gt;You're welcome &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;And yes, that is a very valuable skill to develop as a Splunk user/admin &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 13:19:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-Splunk-Regex-to-search-for-a-field-after-n/m-p/301179#M90688</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-02-21T13:19:41Z</dc:date>
    </item>
  </channel>
</rss>

