<?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: Need help with RegEx in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284475#M86027</link>
    <description>&lt;P&gt;Thank you guys, I will need to improve my regex skills since the Field Extractor barely works.&lt;/P&gt;

&lt;P&gt;How would I modify the regex if there is white space after the 6 digits? &lt;/P&gt;

&lt;P&gt;Like it doesn't match for this case:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;00012220          *O082017020900024800000000q0025047000011000000009000000009000000001000000000000000000
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 10 Feb 2017 14:59:38 GMT</pubDate>
    <dc:creator>omuelle1</dc:creator>
    <dc:date>2017-02-10T14:59:38Z</dc:date>
    <item>
      <title>Need help with RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284472#M86024</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to extract a field in Splunk but the field extraction doesn't work and throws this error &lt;/P&gt;

&lt;P&gt;"The extraction failed. If you are extracting multiple fields, try removing one or more fields. Start with extractions that are embedded within longer text strings."&lt;/P&gt;

&lt;P&gt;Therefore I am trying to write the regex myself but I am not really good at regex, so I would you guys help.&lt;/P&gt;

&lt;P&gt;I want to skip the first two number in this string and extract the upcoming 6:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;0035373112473B    CC002017020809521700000001r200000432                                                                                            SYSTEM      201702081437521  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So in this case I want my Field to contain 353731.&lt;/P&gt;

&lt;P&gt;This is my current regex but I don't know how I can get it to skip the first two numbers.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;ITEM&amp;gt;\s*\s*K\^[0-9][0-9][0-9][0-9][0-9][0-9])
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you,&lt;/P&gt;

&lt;P&gt;Oliver&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 13:50:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284472#M86024</guid>
      <dc:creator>omuelle1</dc:creator>
      <dc:date>2017-02-10T13:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284473#M86025</link>
      <description>&lt;P&gt;Hi there, &lt;/P&gt;

&lt;P&gt;if your capturing group is already matching, you can just pull the first two digets (\d{2}) out of the capturing group. &lt;/P&gt;

&lt;P&gt;just execute this as an example:   &lt;CODE&gt;| makeresults | eval test="0035373112473B" | rex field=test "\d{2}(?&amp;lt;ITEM&amp;gt;\d{6})"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Greetings&lt;/P&gt;

&lt;P&gt;Edited the regex &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 14:48:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284473#M86025</guid>
      <dc:creator>hgrow</dc:creator>
      <dc:date>2017-02-10T14:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284474#M86026</link>
      <description>&lt;P&gt;Based on your event in the above:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^\d{2}(?&amp;lt;mystring&amp;gt;\d{6})\w+
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That looks at the beginning of the line, skips the first 2 digits, and captures the next 6 digits.&lt;/P&gt;

&lt;P&gt;Check out this website : &lt;A href="https://regex101.com/r/awrCuI/1"&gt;https://regex101.com/r/awrCuI/1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 14:52:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284474#M86026</guid>
      <dc:creator>esix_splunk</dc:creator>
      <dc:date>2017-02-10T14:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284475#M86027</link>
      <description>&lt;P&gt;Thank you guys, I will need to improve my regex skills since the Field Extractor barely works.&lt;/P&gt;

&lt;P&gt;How would I modify the regex if there is white space after the 6 digits? &lt;/P&gt;

&lt;P&gt;Like it doesn't match for this case:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;00012220          *O082017020900024800000000q0025047000011000000009000000009000000001000000000000000000
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Feb 2017 14:59:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284475#M86027</guid>
      <dc:creator>omuelle1</dc:creator>
      <dc:date>2017-02-10T14:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284476#M86028</link>
      <description>&lt;P&gt;You should just be able to leave out esixs \w+ if im correct &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;In your case it should not matter what is coming after the first 6 digits --whitespaces or some characters since you will always want the digits right after the beginning of the line.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;^\d{2}(?&amp;lt;mystring&amp;gt;\d{6})&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 15:03:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284476#M86028</guid>
      <dc:creator>hgrow</dc:creator>
      <dc:date>2017-02-10T15:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284477#M86029</link>
      <description>&lt;P&gt;You can just use this..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ^\w{2}(?&amp;lt;mystring&amp;gt;\d{6})
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here the \w denotes a word space, so all letters upper and lower, numbers, and spaces.. So this will catch events that start with numbers, letters, or spaces  x 2&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 15:06:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284477#M86029</guid>
      <dc:creator>esix_splunk</dc:creator>
      <dc:date>2017-02-10T15:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284478#M86030</link>
      <description>&lt;P&gt;Thank you guys!!&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2017 15:31:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284478#M86030</guid>
      <dc:creator>omuelle1</dc:creator>
      <dc:date>2017-02-10T15:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284479#M86031</link>
      <description>&lt;P&gt;Could you guys also help to me how get the *O (It can be any 2 characters) but always at that same position. I tried the same thing you guys told me, but the skipping doesn't work, I assume because there is space in between.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;00012220         *O082017020900024800000000q0025047000011000000009000000009000000001000000000000000000
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Feb 2017 19:34:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284479#M86031</guid>
      <dc:creator>omuelle1</dc:creator>
      <dc:date>2017-02-10T19:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284480#M86032</link>
      <description>&lt;P&gt;&lt;CODE&gt;^\w+\s+(?&amp;lt;field&amp;gt;.{2})&lt;/CODE&gt;might do it?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 07:39:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284480#M86032</guid>
      <dc:creator>hgrow</dc:creator>
      <dc:date>2017-02-13T07:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284481#M86033</link>
      <description>&lt;P&gt;You can try this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(\s+|\w+)(?&amp;lt;digits&amp;gt;\d{7})\s+(?&amp;lt;next&amp;gt;\*\w)\w+
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This assumes the Patter is also    &lt;EM&gt;**O&lt;/EM&gt;*, that is asterisks + Letter.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 09:00:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284481#M86033</guid>
      <dc:creator>esix_splunk</dc:creator>
      <dc:date>2017-02-13T09:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with RegEx</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284482#M86034</link>
      <description>&lt;P&gt;Both worked for me, thank you guys!&lt;/P&gt;</description>
      <pubDate>Mon, 13 Feb 2017 14:49:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-RegEx/m-p/284482#M86034</guid>
      <dc:creator>omuelle1</dc:creator>
      <dc:date>2017-02-13T14:49:34Z</dc:date>
    </item>
  </channel>
</rss>

