<?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: REGEX extract field at certain position in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/REGEX-extract-field-at-certain-position/m-p/192487#M55352</link>
    <description>&lt;P&gt;Sorry - note the version I'm using in Splunk is&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/(?&amp;lt;lvl&amp;gt;&amp;lt;=^.{54})([0-9])/mg
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to specify that I want the result to be put in the lvl field.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Mar 2015 17:16:46 GMT</pubDate>
    <dc:creator>tjohnson341</dc:creator>
    <dc:date>2015-03-23T17:16:46Z</dc:date>
    <item>
      <title>REGEX extract field at certain position</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REGEX-extract-field-at-certain-position/m-p/192484#M55349</link>
      <description>&lt;P&gt;I am attempting to extract fields from a file which was created to be human readable, so it has fields aligned at certain column numbers throughout. I wrote a regular expression to get a digit character at a specific column number and extract that to the lvl field. The actual expression is &lt;/P&gt;

&lt;P&gt;(?&amp;lt;=^.{54})([0-9])&lt;/P&gt;

&lt;P&gt;This expression works without the  field specification in Notepad++ for a search within the file that I'm trying to extract fields from in Splunk, but it doesn't find any suitable field values when used in the rex command or in Field Extraction. I figured this was a difference in syntax for PCRE regexes, or that there is a multiline specification that I'm missing. Adding a \m to the regex did not seem to do the trick.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 16:51:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REGEX-extract-field-at-certain-position/m-p/192484#M55349</guid>
      <dc:creator>tjohnson341</dc:creator>
      <dc:date>2015-03-23T16:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: REGEX extract field at certain position</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REGEX-extract-field-at-certain-position/m-p/192485#M55350</link>
      <description>&lt;P&gt;Try testing your expressions at &lt;A href="https://www.regex101.com/"&gt;https://www.regex101.com/&lt;/A&gt;.  It supports PCRE expressions.&lt;BR /&gt;
If you post a sample of your input here someone may be able to spot where you've made an error.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 16:57:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REGEX-extract-field-at-certain-position/m-p/192485#M55350</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-03-23T16:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: REGEX extract field at certain position</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REGEX-extract-field-at-certain-position/m-p/192486#M55351</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;SSN         Emplid  Employee Name                     Lvl   Field Name                       Field Value                      Err#   Error Description                                                                  Resp   Position

xxxxxxxxx   xxxxxx  Testy, Tester A                   2     Organization                     testval                          0086   Organization is blank or invalid                                                   L      testval                       
xxxxxxxxx   xxxxxx  Testname, Test                    2     Organization                     testval                          0086   Organization is blank or invalid                                                   L      testval                       
xxxxxxxxx   xxxxxx  Testerman, Testly                 2     Organization                     testval                          0086   Organization is blank or invalid                                                   L      testval  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is the input sample I used, and the exact expression the tester used is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/(?&amp;lt;=^.{54})([0-9])/mg
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now I added the global modifier - the /g, and it did find all of the field values I was expecting. This regex still is not working in the Field Extractor or with the rex command, when I input it exactly as shown above.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 17:13:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REGEX-extract-field-at-certain-position/m-p/192486#M55351</guid>
      <dc:creator>tjohnson341</dc:creator>
      <dc:date>2015-03-23T17:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: REGEX extract field at certain position</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REGEX-extract-field-at-certain-position/m-p/192487#M55352</link>
      <description>&lt;P&gt;Sorry - note the version I'm using in Splunk is&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/(?&amp;lt;lvl&amp;gt;&amp;lt;=^.{54})([0-9])/mg
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to specify that I want the result to be put in the lvl field.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 17:16:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REGEX-extract-field-at-certain-position/m-p/192487#M55352</guid>
      <dc:creator>tjohnson341</dc:creator>
      <dc:date>2015-03-23T17:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: REGEX extract field at certain position</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REGEX-extract-field-at-certain-position/m-p/192488#M55353</link>
      <description>&lt;P&gt;This worked for me in regex101.com using your sample input.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"(?mg)^.{55}(?&amp;lt;lvl&amp;gt;[0-9])"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've abandoned the field extractor as it seems to rarely work well for me.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Mar 2015 18:02:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REGEX-extract-field-at-certain-position/m-p/192488#M55353</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-03-23T18:02:31Z</dc:date>
    </item>
  </channel>
</rss>

