<?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: rex Named extraction for acronyms that have 4 letters and are all capital letters in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/rex-Named-extraction-for-acronyms-that-have-4-letters-and-are/m-p/365366#M107770</link>
    <description>&lt;P&gt;The regex you need is just the following&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[A-Z]{4}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In terms of the named extraction you are talking about it all depends where you want to do this.&lt;BR /&gt;
If you are happy to do it in SPL simply use rex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your query here
| rex field=YOUR_FIELD_WITH_ACRONMYS "(?&amp;lt;named_field&amp;gt;[A-Z]{4})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which will create a new field called "named_field".&lt;/P&gt;

&lt;P&gt;If you are expecting more than 1 match in a single event then use max_match=0 in your rex command. It'll then create "named_field" as a multivalue field.&lt;/P&gt;

&lt;P&gt;If you want to do this in props.conf and/or transforms.conf I would recommend you read the following doc as again, it all depends on your use case and I don't have enough information to give you a decent advice:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;EXAMPLES&lt;/STRONG&gt;&lt;BR /&gt;
This might be the simplest one of all in props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-acronyms = (?&amp;lt;named_field&amp;gt;[A-Z]{4})
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you wanted that multivalue you could use REPORT in props.conf and then elaborate the extraction in transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# props.conf
[your_sourcetype]
REPORT-acronyms = mv_acronyms

# transforms.conf
[mv_acronyms]
REGEX = (?&amp;lt;named_field&amp;gt;[A-Z]{4})
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps as a start,&lt;BR /&gt;
J&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 15:21:35 GMT</pubDate>
    <dc:creator>javiergn</dc:creator>
    <dc:date>2020-09-29T15:21:35Z</dc:date>
    <item>
      <title>rex Named extraction for acronyms that have 4 letters and are all capital letters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-Named-extraction-for-acronyms-that-have-4-letters-and-are/m-p/365365#M107769</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;I'm trying to create a named extraction and want to use regex to find all instance of 4 letter acronyms that are all capitol letters.&lt;BR /&gt;&lt;BR /&gt;
i.e.:  ABCD, DEFG, HIJK, LMNO. &lt;/P&gt;

&lt;P&gt;Needs to find only 4 consecution letters that are all CAPS.  &lt;/P&gt;

&lt;P&gt;Anyone able to provide an example for the syntax I need? &lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2017 07:05:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-Named-extraction-for-acronyms-that-have-4-letters-and-are/m-p/365365#M107769</guid>
      <dc:creator>agoktas</dc:creator>
      <dc:date>2017-08-15T07:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: rex Named extraction for acronyms that have 4 letters and are all capital letters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-Named-extraction-for-acronyms-that-have-4-letters-and-are/m-p/365366#M107770</link>
      <description>&lt;P&gt;The regex you need is just the following&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[A-Z]{4}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In terms of the named extraction you are talking about it all depends where you want to do this.&lt;BR /&gt;
If you are happy to do it in SPL simply use rex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your query here
| rex field=YOUR_FIELD_WITH_ACRONMYS "(?&amp;lt;named_field&amp;gt;[A-Z]{4})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which will create a new field called "named_field".&lt;/P&gt;

&lt;P&gt;If you are expecting more than 1 match in a single event then use max_match=0 in your rex command. It'll then create "named_field" as a multivalue field.&lt;/P&gt;

&lt;P&gt;If you want to do this in props.conf and/or transforms.conf I would recommend you read the following doc as again, it all depends on your use case and I don't have enough information to give you a decent advice:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;EXAMPLES&lt;/STRONG&gt;&lt;BR /&gt;
This might be the simplest one of all in props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EXTRACT-acronyms = (?&amp;lt;named_field&amp;gt;[A-Z]{4})
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you wanted that multivalue you could use REPORT in props.conf and then elaborate the extraction in transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# props.conf
[your_sourcetype]
REPORT-acronyms = mv_acronyms

# transforms.conf
[mv_acronyms]
REGEX = (?&amp;lt;named_field&amp;gt;[A-Z]{4})
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope that helps as a start,&lt;BR /&gt;
J&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:21:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-Named-extraction-for-acronyms-that-have-4-letters-and-are/m-p/365366#M107770</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2020-09-29T15:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: rex Named extraction for acronyms that have 4 letters and are all capital letters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-Named-extraction-for-acronyms-that-have-4-letters-and-are/m-p/365367#M107771</link>
      <description>&lt;P&gt;@agoktas please do not forget to accept an answer if you are happy with it&lt;/P&gt;</description>
      <pubDate>Tue, 29 May 2018 10:08:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-Named-extraction-for-acronyms-that-have-4-letters-and-are/m-p/365367#M107771</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2018-05-29T10:08:00Z</dc:date>
    </item>
  </channel>
</rss>

