<?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 can I extract values starting with a specific name using regex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419900#M120734</link>
    <description>&lt;P&gt;Assuming that they all have exactly the same number of numbers after them (12)...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | rex field=_raw max_match=0 "(?&amp;lt;INC_Number&amp;gt;INC\d{12})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above will extract all INC numbers in the field _raw and put them in a multivalue field.  You can query how many matches were made with... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval MatchCount=coalesce(mvcount(INC_Number),0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The coalesce will set the count to 0 if there were no matches.  &lt;/P&gt;

&lt;P&gt;If they can have a range of number lengths, say 10 to 12, then change the &lt;CODE&gt;\d{12}&lt;/CODE&gt; to &lt;CODE&gt;\d{10,12}&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Aug 2018 05:13:44 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2018-08-23T05:13:44Z</dc:date>
    <item>
      <title>How can I extract values starting with a specific name using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419899#M120733</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;Kindly help me with regex for below sample data.&lt;BR /&gt;
Its only a sample there might be some other pattern of data. &lt;BR /&gt;
I need to extract only the  values starting with &lt;CODE&gt;INC&lt;/CODE&gt; eg(INC000013444216,INC000033109432,INC000000000958,INC000014660933) and store in a separate field.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;DESCRIPTION"Request Information ticket no.: INC000013444216"
DESCRIPTION"Gathered Info ticket no.:INC000033109432 &amp;amp; the bad data."
DESCRIPTION"DDD D Required Informed ticket no.:INC000000000958 "
DESCRIPTION"Defined Info ticket no.:INC000013444444 hsdcgs and FRGHBB" 
DESCRIPTION"DD DS Access of the ticket no.:INC000000000958 and INC000014660933"
DESCRIPTION"Self comment ticket no.: INC000014141414 &amp;amp; INC000014071414"
DESCRIPTION"Known data ticket no.: INC000014222242 (INC000014555536)"
DESCRIPTION"Other DB ticket no.: INC000013777778 | 6020359"
DESCRIPTION"My Data base ticket no.:INC000013788880 and INC000013999916"
DESCRIPTION"Stay For the Information ticket no.: INC000013111117 | INC000013123418 "
DESCRIPTION"Check Info ticket no.: INC000012345597 INC000000003596 INC000009873598 INC000067893599"
DESCRIPTION"Correct Informed ticket no.:INC000045675462, INC000009878538 "
DESCRIPTION"All Information ticket no.:INC000067898690 (5393953), INC000011114463 (5536973) and more"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 05:01:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419899#M120733</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2018-08-23T05:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract values starting with a specific name using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419900#M120734</link>
      <description>&lt;P&gt;Assuming that they all have exactly the same number of numbers after them (12)...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | rex field=_raw max_match=0 "(?&amp;lt;INC_Number&amp;gt;INC\d{12})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The above will extract all INC numbers in the field _raw and put them in a multivalue field.  You can query how many matches were made with... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval MatchCount=coalesce(mvcount(INC_Number),0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The coalesce will set the count to 0 if there were no matches.  &lt;/P&gt;

&lt;P&gt;If they can have a range of number lengths, say 10 to 12, then change the &lt;CODE&gt;\d{12}&lt;/CODE&gt; to &lt;CODE&gt;\d{10,12}&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 05:13:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419900#M120734</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-08-23T05:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract values starting with a specific name using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419901#M120735</link>
      <description>&lt;P&gt;@shankarananth Some of your events have more than one &lt;CODE&gt;INC#####&lt;/CODE&gt;, do you want to extract all? Also There is one event with &lt;CODE&gt;| 6020359&lt;/CODE&gt;. Is that INC as well?&lt;/P&gt;

&lt;P&gt;Can you try the following run anywhere example?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval description=" DESCRIPTION\"Request Information ticket no.: INC000013444216\";
 DESCRIPTION\"Gathered Info ticket no.:INC000033109432 &amp;amp; the bad data.\";
 DESCRIPTION\"DDD D Required Informed ticket no.:INC000000000958 \";
 DESCRIPTION\"Defined Info ticket no.:INC000013444444 hsdcgs and FRGHBB\"; 
 DESCRIPTION\"DD DS Access of the ticket no.:INC000000000958 and INC000014660933\";
 DESCRIPTION\"Self comment ticket no.: INC000014141414 &amp;amp; INC000014071414\";
 DESCRIPTION\"Known data ticket no.: INC000014222242 (INC000014555536)\";
 DESCRIPTION\"Other DB ticket no.: INC000013777778 | 6020359\";
 DESCRIPTION\"My Data base ticket no.:INC000013788880 and INC000013999916\";
 DESCRIPTION\"Stay For the Information ticket no.: INC000013111117 | INC000013123418 \";
 DESCRIPTION\"Check Info ticket no.: INC000012345597 INC000000003596 INC000009873598 INC000067893599\";
 DESCRIPTION\"Correct Informed ticket no.:INC000045675462, INC000009878538 \";
 DESCRIPTION\"All Information ticket no.:INC000067898690 (5393953), INC000011114463 (5536973) and more\""
| makemv description delim=";"
| mvexpand description
| rex field="description" "(?&amp;lt;IncidentNumber&amp;gt;INC\d+)" max_match=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;max_match=0&lt;/CODE&gt; extracts multiple Incident Numbers. If you remove the argument it will extract only first occurrence.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 05:16:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419901#M120735</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-08-23T05:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract values starting with a specific name using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419902#M120736</link>
      <description>&lt;P&gt;@niketnilay,&lt;/P&gt;

&lt;P&gt;It's working fine.. Thanks for your help :-). &lt;BR /&gt;
I hope still i need to upgrade myself in many things.. &lt;/P&gt;

&lt;P&gt;Please convert your comment into answers.. So i can accept it ..&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 05:27:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419902#M120736</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2018-08-23T05:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract values starting with a specific name using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419903#M120737</link>
      <description>&lt;P&gt;@ DalJeanis,&lt;/P&gt;

&lt;P&gt;I have tried your too its working good .. &lt;BR /&gt;
A small addition &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | rex field=_raw max_match=0 "(?&amp;lt;INC_Number&amp;gt;INC\d{12})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks you ....&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 05:32:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419903#M120737</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2018-08-23T05:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract values starting with a specific name using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419904#M120738</link>
      <description>&lt;P&gt;I've converted the comment to an answer, so it can now be accepted, @shankarananth.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Aug 2018 16:10:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419904#M120738</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2018-08-23T16:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract values starting with a specific name using regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419905#M120739</link>
      <description>&lt;P&gt;@shankarananth - updated.  Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 26 Aug 2018 20:31:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-values-starting-with-a-specific-name-using/m-p/419905#M120739</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-08-26T20:31:47Z</dc:date>
    </item>
  </channel>
</rss>

