<?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: Another RegEx Question in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Another-RegEx-Question/m-p/195279#M56315</link>
    <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;base search=""&amp;gt; | rex field=_raw "COMPANY\\\(?&amp;lt;testid&amp;gt;\w+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The parenthesis are the regex capturing group, and the expression of the items you're trying to capture must be inside the parenthesis to be extracted as the field value.  &lt;/P&gt;</description>
    <pubDate>Wed, 19 Mar 2014 17:24:01 GMT</pubDate>
    <dc:creator>wpreston</dc:creator>
    <dc:date>2014-03-19T17:24:01Z</dc:date>
    <item>
      <title>Another RegEx Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-RegEx-Question/m-p/195278#M56314</link>
      <description>&lt;P&gt;I have been engaged in an arm wresting content with Splunk for the past couple of hours with regex and it has been beating me pretty soundly. I have read the Splunk docs and looked at the various regex help sites but I can't get it working.  In fact, my regex works on &lt;A href="http://rubular.com/"&gt;http://rubular.com/&lt;/A&gt; just fine.  But when I put it in a search is barfs.., then laughs at me.&lt;/P&gt;

&lt;P&gt;I have weblog data and I would like to search for COMPANY\userID and place userID in a label for use down the pipeline.  This is what the data looks like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2014-03-19 12:58:00 W3SVXYZ 10.0.0.1 POST COMPANY\userID 10.1.1.1 .....
2014-03-19 12:59:00 W3SVXYZ 10.0.0.1 GET COMPANY\userID 10.2.2.2 .....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to extract the userID and then perform stats on them (number of concurrent users, etc).&lt;/P&gt;

&lt;P&gt;My code so far that works in Perl is "COMPANY\\w+" but when I use it in splunk it tanks.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;base search&amp;gt; | rex field=_raw "COMPANY\\\w+(?&amp;lt;testID&amp;gt;)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It does not populate the testID field correctly and it also includes results that do not have COMPANY in it.&lt;BR /&gt;
Thanks in advance for any tips or tricks!  Mike&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 17:08:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-RegEx-Question/m-p/195278#M56314</guid>
      <dc:creator>lehrfeld</dc:creator>
      <dc:date>2014-03-19T17:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Another RegEx Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-RegEx-Question/m-p/195279#M56315</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;base search=""&amp;gt; | rex field=_raw "COMPANY\\\(?&amp;lt;testid&amp;gt;\w+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The parenthesis are the regex capturing group, and the expression of the items you're trying to capture must be inside the parenthesis to be extracted as the field value.  &lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 17:24:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-RegEx-Question/m-p/195279#M56315</guid>
      <dc:creator>wpreston</dc:creator>
      <dc:date>2014-03-19T17:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Another RegEx Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-RegEx-Question/m-p/195280#M56316</link>
      <description>&lt;P&gt;Thanks for the response - Using the above regex yields an error - "unmatched parentheses" But when I place a space after the double backslash the results are not correct.  It almost appears that the backslash in "COMPANY\userID" is not being found by the regex&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 17:34:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-RegEx-Question/m-p/195280#M56316</guid>
      <dc:creator>lehrfeld</dc:creator>
      <dc:date>2014-03-19T17:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Another RegEx Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-RegEx-Question/m-p/195281#M56317</link>
      <description>&lt;P&gt;Use 3 slashes and no space.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 17:47:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-RegEx-Question/m-p/195281#M56317</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-03-19T17:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: Another RegEx Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-RegEx-Question/m-p/195282#M56318</link>
      <description>&lt;P&gt;3 slashes did it!  Any comment on why three are needed in this case?  Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 17:59:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-RegEx-Question/m-p/195282#M56318</guid>
      <dc:creator>lehrfeld</dc:creator>
      <dc:date>2014-03-19T17:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Another RegEx Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-RegEx-Question/m-p/195283#M56319</link>
      <description>&lt;P&gt;To escape " , we added 1 slash. To escape that slash we added another two slashes.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 18:48:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-RegEx-Question/m-p/195283#M56319</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-03-19T18:48:56Z</dc:date>
    </item>
  </channel>
</rss>

