<?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: Extract last 3 characters from field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-last-3-characters-from-field/m-p/245691#M73234</link>
    <description>&lt;P&gt;Why not the simpler with negative index:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;substr(x,-3)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 23 Jul 2019 03:57:01 GMT</pubDate>
    <dc:creator>JCISplunker</dc:creator>
    <dc:date>2019-07-23T03:57:01Z</dc:date>
    <item>
      <title>Extract last 3 characters from field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-last-3-characters-from-field/m-p/245688#M73231</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am trying to extract the last 3 characters from an extracted field. The field is in the format of 122RN00578COM or QN00001576VSD - numbers vary and length may vary over time) and the characters I am trying to extract are COM, VSD etc&lt;/P&gt;

&lt;P&gt;I have tried using Substr and whilst this works in the short term any variation in length of field throws it off.&lt;BR /&gt;
Is there a more robust method that will allow for changes in field length whilst maintaining the extraction of the last 3 characters (these are always letters)?&lt;/P&gt;

&lt;P&gt;Thanks in advance for any help or suggestions.&lt;/P&gt;

&lt;P&gt;Alastair&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 01:04:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-last-3-characters-from-field/m-p/245688#M73231</guid>
      <dc:creator>ahogbin</dc:creator>
      <dc:date>2016-07-07T01:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Extract last 3 characters from field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-last-3-characters-from-field/m-p/245689#M73232</link>
      <description>&lt;P&gt;This should give you last 3,  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;substr(x, len(x)-2, 3)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The other option would be to use rex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=x "(?&amp;lt;y&amp;gt;\w{3})$" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jul 2016 01:12:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-last-3-characters-from-field/m-p/245689#M73232</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-07T01:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extract last 3 characters from field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-last-3-characters-from-field/m-p/245690#M73233</link>
      <description>&lt;P&gt;Superstar.. thank you so much&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 01:19:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-last-3-characters-from-field/m-p/245690#M73233</guid>
      <dc:creator>ahogbin</dc:creator>
      <dc:date>2016-07-07T01:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Extract last 3 characters from field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-last-3-characters-from-field/m-p/245691#M73234</link>
      <description>&lt;P&gt;Why not the simpler with negative index:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;substr(x,-3)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jul 2019 03:57:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-last-3-characters-from-field/m-p/245691#M73234</guid>
      <dc:creator>JCISplunker</dc:creator>
      <dc:date>2019-07-23T03:57:01Z</dc:date>
    </item>
  </channel>
</rss>

