<?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 generation in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-generation/m-p/469826#M192079</link>
    <description>&lt;P&gt;Hi Deepz2612,&lt;BR /&gt;
I don't see the set of events.&lt;BR /&gt;
Anyway, to extract the last word od an event and put it in a field, you could use a regex like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\s+(?&amp;lt;my_field&amp;gt;\w+)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/hofrdl/1"&gt;https://regex101.com/r/hofrdl/1&lt;/A&gt; .&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Fri, 25 Oct 2019 16:40:05 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2019-10-25T16:40:05Z</dc:date>
    <item>
      <title>Regex generation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-generation/m-p/469824#M192077</link>
      <description>&lt;P&gt;I have the below set of events where I wanted to write regex to capture only the last word &lt;/P&gt;

&lt;P&gt;Kindly help&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 11:56:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-generation/m-p/469824#M192077</guid>
      <dc:creator>Deepz2612</dc:creator>
      <dc:date>2019-10-25T11:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Regex generation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-generation/m-p/469825#M192078</link>
      <description>&lt;P&gt;Assuming you just want the last word in each event, this should work fine:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.+\b(\w+)$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you want a more restrictive match, looking for &lt;STRONG&gt;only&lt;/STRONG&gt; "begin" or "end", then this should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.+\b(begin|end)$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps!&lt;BR /&gt;
rmmiller&lt;/P&gt;

&lt;P&gt;Edit:  Used &lt;A href="https://regexr.com/"&gt;https://regexr.com/&lt;/A&gt; to test/generate regex.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 16:06:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-generation/m-p/469825#M192078</guid>
      <dc:creator>rmmiller</dc:creator>
      <dc:date>2019-10-25T16:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Regex generation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-generation/m-p/469826#M192079</link>
      <description>&lt;P&gt;Hi Deepz2612,&lt;BR /&gt;
I don't see the set of events.&lt;BR /&gt;
Anyway, to extract the last word od an event and put it in a field, you could use a regex like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\s+(?&amp;lt;my_field&amp;gt;\w+)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/hofrdl/1"&gt;https://regex101.com/r/hofrdl/1&lt;/A&gt; .&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 16:40:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-generation/m-p/469826#M192079</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-25T16:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: Regex generation</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-generation/m-p/469827#M192080</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "(?&amp;lt;LastWord&amp;gt;\w+)$"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 25 Oct 2019 20:22:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-generation/m-p/469827#M192080</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-10-25T20:22:56Z</dc:date>
    </item>
  </channel>
</rss>

