<?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 do you make a regex field extraction to stop capture after underscore and last 2 digits? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402261#M116401</link>
    <description>&lt;P&gt;&lt;CODE&gt;(?&amp;lt;my_field_name&amp;gt;car_\w+\-Cluster_\d{2})&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;this matches the exact string "car_somelettershere-Cluster_" (the  &lt;CODE&gt;\w+&lt;/CODE&gt; part will match any alpha characters in the middle) and then will capture the next two  &lt;CODE&gt;{2}&lt;/CODE&gt; digits  &lt;CODE&gt;\d&lt;/CODE&gt; at the end of the string&lt;/P&gt;

&lt;P&gt;also, just in case you haven't used/seen this before: &lt;A href="https://regex101.com/" target="_blank"&gt;https://regex101.com/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 23:18:21 GMT</pubDate>
    <dc:creator>marycordova</dc:creator>
    <dc:date>2020-09-29T23:18:21Z</dc:date>
    <item>
      <title>How do you make a regex field extraction to stop capture after underscore and last 2 digits?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402259#M116399</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm new to regex field extraction.  I need a regex to capture only specific characters on my event source.  I tried .car_(?.+20) but it gives me an output that I don't want:&lt;/P&gt;

&lt;P&gt;Nam-Cluster_01_20&lt;BR /&gt;
Nam-Cluster_02_20&lt;BR /&gt;
Nam-Cluster_03_201902191052_20&lt;/P&gt;

&lt;P&gt;Sample File Path:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; /path1/path2/path3/path4/path5/car_Nam-Cluster_01_201902190559_41795
 /path1/path2/path3/path4/path5/car_Nam-Cluster_01_201902190559_41795
 /path1/path2/path3/path4/path5/car_Nam-Cluster_01_201902190557_41794
 /path1/path2/path3/path4/path5/car_Nam-Cluster_02_201902191428_194444
 /path1/path2/path3/path4/path5/car_Nam-Cluster_02_201902190754_194346
 /path1/path2/path3/path4/path5/car_Nam-Cluster_02_201902190754_194346
 /path1/path2/path3/path4/path5/car_Nam-Cluster_03_201902191052_209807
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Needed Output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;car_Nam-Cluster_01
car_Nam-Cluster_02
car_Nam-Cluster_03
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:23:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402259#M116399</guid>
      <dc:creator>almar_cabato</dc:creator>
      <dc:date>2020-09-29T23:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex field extraction to stop capture after underscore and last 2 digits?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402260#M116400</link>
      <description>&lt;P&gt;It is not the most efficient, but you can use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex field=foo "car_(?&amp;lt;new_field&amp;gt;.+?)_20"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;instead. This added ? says to not be greedy. &lt;/P&gt;</description>
      <pubDate>Tue, 19 Feb 2019 19:20:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402260#M116400</guid>
      <dc:creator>reed_kelly</dc:creator>
      <dc:date>2019-02-19T19:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex field extraction to stop capture after underscore and last 2 digits?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402261#M116401</link>
      <description>&lt;P&gt;&lt;CODE&gt;(?&amp;lt;my_field_name&amp;gt;car_\w+\-Cluster_\d{2})&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;this matches the exact string "car_somelettershere-Cluster_" (the  &lt;CODE&gt;\w+&lt;/CODE&gt; part will match any alpha characters in the middle) and then will capture the next two  &lt;CODE&gt;{2}&lt;/CODE&gt; digits  &lt;CODE&gt;\d&lt;/CODE&gt; at the end of the string&lt;/P&gt;

&lt;P&gt;also, just in case you haven't used/seen this before: &lt;A href="https://regex101.com/" target="_blank"&gt;https://regex101.com/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:18:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402261#M116401</guid>
      <dc:creator>marycordova</dc:creator>
      <dc:date>2020-09-29T23:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex field extraction to stop capture after underscore and last 2 digits?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402262#M116402</link>
      <description>&lt;P&gt;Thank you marycordova.  This is almost close to what I'm looking for.  But if my data changes to something like:&lt;/P&gt;

&lt;P&gt;/path1/path2/path3/path4/path5/car_Nam-Cluster_01_201902190559_41795&lt;BR /&gt;
/path1/path2/path3/path4/path5/car_Nam-Cluster_02_201902190559_41796&lt;BR /&gt;
/path1/path2/path3/path4/path5/car_Nam-Cluster_03_201902190559_41797&lt;BR /&gt;
/path1/path2/path3/path4/path5/car_Asia-Cluster_01_201902190559_41795&lt;BR /&gt;
/path1/path2/path3/path4/path5/car_Asia-Cluster_02_201902190559_41796&lt;BR /&gt;
/path1/path2/path3/path4/path5/car_Asia-Cluster_03_201902190559_41797&lt;BR /&gt;
/path1/path2/path3/path4/path5/car_EMEA-Cluster_01_201902190559_41795&lt;BR /&gt;
/path1/path2/path3/path4/path5/car_EMEA-Cluster_02_201902190559_41796&lt;BR /&gt;
/path1/path2/path3/path4/path5/car_EMEA-Cluster_03_201902190559_41797&lt;BR /&gt;
/path1/path2/path3/path4/path5/car_India-Cluster_01_201902190559_41795&lt;BR /&gt;
/path1/path2/path3/path4/path5/car_India-Cluster_02_201902190559_41796&lt;BR /&gt;
/path1/path2/path3/path4/path5/car_India-Cluster_03_201902190559_41797&lt;/P&gt;

&lt;P&gt;it only captures,&lt;/P&gt;

&lt;P&gt;car_Nam-Cluster_01&lt;BR /&gt;
car_Nam-Cluster_02&lt;BR /&gt;
car_Nam-Cluster_03&lt;/P&gt;

&lt;P&gt;but not,&lt;/P&gt;

&lt;P&gt;car_Asia-Cluster_01&lt;BR /&gt;
car_Asia-Cluster_02&lt;BR /&gt;
car_Asia-Cluster_03&lt;BR /&gt;
car_EMEA-Cluster_01&lt;BR /&gt;
car_EMEA-Cluster_02&lt;BR /&gt;
car_EMEA-Cluster_03&lt;BR /&gt;
car_India-Cluster_01&lt;BR /&gt;
car_India-Cluster_02&lt;BR /&gt;
car_India-Cluster_03&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:23:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402262#M116402</guid>
      <dc:creator>almar_cabato</dc:creator>
      <dc:date>2020-09-29T23:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex field extraction to stop capture after underscore and last 2 digits?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402263#M116403</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;.*\/(?P&amp;lt;field&amp;gt;.*\_\d{2})\_.*$&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;,Try this:&lt;BR /&gt;
.&lt;EM&gt;\/(?P.&lt;/EM&gt;_\d{2})_.*&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 01:24:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402263#M116403</guid>
      <dc:creator>paranjith</dc:creator>
      <dc:date>2019-02-20T01:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex field extraction to stop capture after underscore and last 2 digits?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402264#M116404</link>
      <description>&lt;P&gt;@almar_cabato try the new edit&lt;/P&gt;

&lt;P&gt;also, if this works, please accept my answer as correct &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 17:40:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402264#M116404</guid>
      <dc:creator>marycordova</dc:creator>
      <dc:date>2019-02-20T17:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex field extraction to stop capture after underscore and last 2 digits?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402265#M116405</link>
      <description>&lt;P&gt;Thank you very much!  This works for me now. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 05:29:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-field-extraction-to-stop-capture-after/m-p/402265#M116405</guid>
      <dc:creator>almar_cabato</dc:creator>
      <dc:date>2019-02-21T05:29:29Z</dc:date>
    </item>
  </channel>
</rss>

