<?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 Need help creating a regex to grab anything after last comma in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166033#M47255</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Hope someone can help me with creating a regular expression for an extraction. I have a log file and the lines don't all have the same amount of information,but the information after the last comma always relates to the same field. I need to create a regular expression to associate anything after the last comma with an event type. When I try to do this without writing the regular expression it does not work for all lines. &lt;/P&gt;

&lt;P&gt;Hope someone can help, let me know if you need more information.&lt;/P&gt;

&lt;P&gt;here is a sample line:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"WBS","20150617131035-any-96095",701,0,"20150617171035Z","10.183.56.173",3,0,"","http://10.183.56.173:10021/mmsc/direct","","M-default","P-default",8799,3367,27,0,0,0,0,0,116,"",0,"",0,"","text/plain","iPhoneOS/8.3 (12F70)",200
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So i would want to grab the "200" in this line but it's not always 200.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Mike&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jun 2015 16:32:56 GMT</pubDate>
    <dc:creator>mikehage</dc:creator>
    <dc:date>2015-06-17T16:32:56Z</dc:date>
    <item>
      <title>Need help creating a regex to grab anything after last comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166033#M47255</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Hope someone can help me with creating a regular expression for an extraction. I have a log file and the lines don't all have the same amount of information,but the information after the last comma always relates to the same field. I need to create a regular expression to associate anything after the last comma with an event type. When I try to do this without writing the regular expression it does not work for all lines. &lt;/P&gt;

&lt;P&gt;Hope someone can help, let me know if you need more information.&lt;/P&gt;

&lt;P&gt;here is a sample line:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"WBS","20150617131035-any-96095",701,0,"20150617171035Z","10.183.56.173",3,0,"","http://10.183.56.173:10021/mmsc/direct","","M-default","P-default",8799,3367,27,0,0,0,0,0,116,"",0,"",0,"","text/plain","iPhoneOS/8.3 (12F70)",200
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So i would want to grab the "200" in this line but it's not always 200.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Mike&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2015 16:32:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166033#M47255</guid>
      <dc:creator>mikehage</dc:creator>
      <dc:date>2015-06-17T16:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need help creating a regex to grab anything after last comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166034#M47256</link>
      <description>&lt;P&gt;A sample of your data would be useful, this will probably get you started.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.. | rex ",(?P&amp;lt;field&amp;gt;[^,]*?)$" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Jun 2015 16:47:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166034#M47256</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-06-17T16:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: Need help creating a regex to grab anything after last comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166035#M47257</link>
      <description>&lt;P&gt;here is a sample line:&lt;/P&gt;

&lt;P&gt;"WBS","20150617131035-any-96095",701,0,"20150617171035Z","10.183.56.173",3,0,"","&lt;A href="http://10.183.56.173:10021/mmsc/direct%22,%22%22,%22M-default%22,%22P-default%22,8799,3367,27,0,0,0,0,0,116,%22%22,0,%22%22,0,%22%22,%22text/plain%22,%22iPhoneOS/8.3"&gt;http://10.183.56.173:10021/mmsc/direct","","M-default","P-default",8799,3367,27,0,0,0,0,0,116,"",0,"",0,"","text/plain","iPhoneOS/8.3&lt;/A&gt; (12F70)",200&lt;/P&gt;

&lt;P&gt;So i would want to grab the "200" in this line but it's not always 200.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2015 17:11:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166035#M47257</guid>
      <dc:creator>mikehage</dc:creator>
      <dc:date>2015-06-17T17:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Need help creating a regex to grab anything after last comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166036#M47258</link>
      <description>&lt;P&gt;The regex string in my answer should do it.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2015 17:19:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166036#M47258</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-06-17T17:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need help creating a regex to grab anything after last comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166037#M47259</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;... | rex ",(?&amp;lt;status&amp;gt;\d+)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Jun 2015 17:20:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166037#M47259</guid>
      <dc:creator>aljohnson_splun</dc:creator>
      <dc:date>2015-06-17T17:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: Need help creating a regex to grab anything after last comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166038#M47260</link>
      <description>&lt;P&gt;If the last field is non-numeric, you will miss it. richgalloway above gave a nice, simple solution, i.e. match all non-comma characters up to the last comma in the line.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 23:31:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166038#M47260</guid>
      <dc:creator>tcottreau</dc:creator>
      <dc:date>2018-04-23T23:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: Need help creating a regex to grab anything after last comma</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166039#M47261</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex ",(?&amp;lt;status&amp;gt;[^,]*)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Apr 2018 00:00:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-creating-a-regex-to-grab-anything-after-last-comma/m-p/166039#M47261</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-04-24T00:00:11Z</dc:date>
    </item>
  </channel>
</rss>

