<?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 Look back two characters in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-Look-back-two-characters/m-p/49842#M11967</link>
    <description>&lt;P&gt;Thanks for the help.&lt;/P&gt;

&lt;P&gt;If you don't mind can you please help with the regex to extract the "mysystem" name just before the _aa&lt;/P&gt;</description>
    <pubDate>Wed, 28 Aug 2013 20:55:07 GMT</pubDate>
    <dc:creator>hartfoml</dc:creator>
    <dc:date>2013-08-28T20:55:07Z</dc:date>
    <item>
      <title>Regex Look back two characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Look-back-two-characters/m-p/49840#M11965</link>
      <description>&lt;P&gt;I am looking for the group name from the phonehome command.&lt;/P&gt;

&lt;P&gt;I tried the auto extractor and it was only marginally helpful.&lt;/P&gt;

&lt;P&gt;Here is the line to read:&lt;BR /&gt;
&lt;CODE&gt;POST /services/broker/phonehome/connection_xxx.xxx.xxx.xxx_xxxx_mysystem.com_mysystem_aa HTTP/1.0&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The piece i am trying to find is the group name "aa" at the end of the string just before the \sHTTP/&lt;/P&gt;

&lt;P&gt;I don't know how to right a regex to look back from the HTTP to find the two group letters.  (always only two letters)&lt;/P&gt;

&lt;P&gt;Any help would be great&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2013 16:41:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Look-back-two-characters/m-p/49840#M11965</guid>
      <dc:creator>hartfoml</dc:creator>
      <dc:date>2013-08-28T16:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Look back two characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Look-back-two-characters/m-p/49841#M11966</link>
      <description>&lt;P&gt;If it is always only two letters, and they are always lowercase, the following should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;GroupName&amp;gt;[a-z]{2})\sHTTP
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can add A-Z inside the [] if they could be uppercase letters.  If you want to try this extraction in Splunk, try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...your search... | rex "(?&amp;lt;GroupName&amp;gt;[a-z]{2})\sHTTP"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Aug 2013 20:19:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Look-back-two-characters/m-p/49841#M11966</guid>
      <dc:creator>wpreston</dc:creator>
      <dc:date>2013-08-28T20:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Look back two characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Look-back-two-characters/m-p/49842#M11967</link>
      <description>&lt;P&gt;Thanks for the help.&lt;/P&gt;

&lt;P&gt;If you don't mind can you please help with the regex to extract the "mysystem" name just before the _aa&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2013 20:55:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Look-back-two-characters/m-p/49842#M11967</guid>
      <dc:creator>hartfoml</dc:creator>
      <dc:date>2013-08-28T20:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Look back two characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Look-back-two-characters/m-p/49843#M11968</link>
      <description>&lt;P&gt;Sure, not a problem.  Using the sample event, this regex should work to extract both fields:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\_(?&amp;lt;SystemName&amp;gt;[^\_]+)\_(?&amp;lt;GroupName&amp;gt;[a-z]{2})\sHTTP
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Aug 2013 01:05:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Look-back-two-characters/m-p/49843#M11968</guid>
      <dc:creator>wpreston</dc:creator>
      <dc:date>2013-08-29T01:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Look back two characters</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Look-back-two-characters/m-p/49844#M11969</link>
      <description>&lt;P&gt;this is great thanks&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2013 13:48:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Look-back-two-characters/m-p/49844#M11969</guid>
      <dc:creator>hartfoml</dc:creator>
      <dc:date>2013-08-29T13:48:36Z</dc:date>
    </item>
  </channel>
</rss>

