<?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 How to edit my regular expression to retrieve the first 7-8 characters of variable length strings that end with abcd.com? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-regular-expression-to-retrieve-the-first-7-8/m-p/223522#M43767</link>
    <description>&lt;P&gt;I am trying to extract router names from syslog messages. &lt;/P&gt;

&lt;P&gt;Need the regular expression to get the first 7 or 8 characters of variable length strings that end with abcd.com. Example below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;tpbjm01-re0.abcd.com
xtsdjm01-re0.abcd.com
lnd2j902-re1.abcd.com
pqrjm02-re1.abcd.com
py3jm01-re1.uk.abcd.com
brhmjm02-re1.emea.abcd.com
rcnj902.abcd.com
cpzyjm01.abcd.com
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So result should be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;tpbjm01
xtsdjm01
lnd2j902
pqrjm02
py3jm01
brhmjm02
rcnj902
cpzyjm01
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is supposed to be the correct regex but it is not pulling anything: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^(?\w{7,8})(?=.*abcd.com)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 27 Sep 2016 19:44:06 GMT</pubDate>
    <dc:creator>christopheryu</dc:creator>
    <dc:date>2016-09-27T19:44:06Z</dc:date>
    <item>
      <title>How to edit my regular expression to retrieve the first 7-8 characters of variable length strings that end with abcd.com?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-regular-expression-to-retrieve-the-first-7-8/m-p/223522#M43767</link>
      <description>&lt;P&gt;I am trying to extract router names from syslog messages. &lt;/P&gt;

&lt;P&gt;Need the regular expression to get the first 7 or 8 characters of variable length strings that end with abcd.com. Example below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;tpbjm01-re0.abcd.com
xtsdjm01-re0.abcd.com
lnd2j902-re1.abcd.com
pqrjm02-re1.abcd.com
py3jm01-re1.uk.abcd.com
brhmjm02-re1.emea.abcd.com
rcnj902.abcd.com
cpzyjm01.abcd.com
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So result should be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;tpbjm01
xtsdjm01
lnd2j902
pqrjm02
py3jm01
brhmjm02
rcnj902
cpzyjm01
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is supposed to be the correct regex but it is not pulling anything: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^(?\w{7,8})(?=.*abcd.com)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Sep 2016 19:44:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-regular-expression-to-retrieve-the-first-7-8/m-p/223522#M43767</guid>
      <dc:creator>christopheryu</dc:creator>
      <dc:date>2016-09-27T19:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to retrieve the first 7-8 characters of variable length strings that end with abcd.com?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-regular-expression-to-retrieve-the-first-7-8/m-p/223523#M43768</link>
      <description>&lt;P&gt;Hello Christopher,&lt;/P&gt;

&lt;P&gt;I was able to use the following on regex101.com with your data set and get your required results using the below.&lt;/P&gt;

&lt;P&gt;([a-zA-Z0-9]{7,8})&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Rich&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2016 23:20:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-regular-expression-to-retrieve-the-first-7-8/m-p/223523#M43768</guid>
      <dc:creator>rrowland</dc:creator>
      <dc:date>2016-09-27T23:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to retrieve the first 7-8 characters of variable length strings that end with abcd.com?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-regular-expression-to-retrieve-the-first-7-8/m-p/223524#M43769</link>
      <description>&lt;P&gt;Thank you for the response @rrowland . I did use regex101 in coming up with regex in my question but it does not work with splunk. I was able do it by splunk's "extract new field" and using add/remove events. Regex below:&lt;/P&gt;

&lt;P&gt;^(?:[^:\n]*:){4}\d+\s+(?P\w+)&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2016 16:17:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-edit-my-regular-expression-to-retrieve-the-first-7-8/m-p/223524#M43769</guid>
      <dc:creator>christopheryu</dc:creator>
      <dc:date>2016-09-28T16:17:31Z</dc:date>
    </item>
  </channel>
</rss>

