<?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 Field extraction regex problem in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction-regex-problem/m-p/84995#M21662</link>
    <description>&lt;P&gt;I have logs that looks like thos&lt;/P&gt;

&lt;P&gt;1: &lt;SYSTEM&gt; username&lt;/SYSTEM&gt;&lt;/P&gt;

&lt;P&gt;So I would like to extract the username from two systems named system1 and system2, when trying to do this in Splunk it fails using a regex that works when I try it outside Splunk&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)(system1|system2)(?-i) (?&amp;lt;SYS_Username&amp;gt;[A-z]+).* 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If i do&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)system1(?-i) (?&amp;lt;SYS_Username&amp;gt;[A-z]+).* 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It works perfect, but only for one system.. The problem seems to come when i introduce the ( | ) syntax.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Apr 2011 08:54:47 GMT</pubDate>
    <dc:creator>mrdaniel</dc:creator>
    <dc:date>2011-04-20T08:54:47Z</dc:date>
    <item>
      <title>Field extraction regex problem</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction-regex-problem/m-p/84995#M21662</link>
      <description>&lt;P&gt;I have logs that looks like thos&lt;/P&gt;

&lt;P&gt;1: &lt;SYSTEM&gt; username&lt;/SYSTEM&gt;&lt;/P&gt;

&lt;P&gt;So I would like to extract the username from two systems named system1 and system2, when trying to do this in Splunk it fails using a regex that works when I try it outside Splunk&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)(system1|system2)(?-i) (?&amp;lt;SYS_Username&amp;gt;[A-z]+).* 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If i do&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)system1(?-i) (?&amp;lt;SYS_Username&amp;gt;[A-z]+).* 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It works perfect, but only for one system.. The problem seems to come when i introduce the ( | ) syntax.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2011 08:54:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction-regex-problem/m-p/84995#M21662</guid>
      <dc:creator>mrdaniel</dc:creator>
      <dc:date>2011-04-20T08:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: Field extraction regex problem</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extraction-regex-problem/m-p/84996#M21663</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
Could you try that :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?i)(?:system1|system2)(?-i) (?&amp;lt;SYS_Username&amp;gt;[A-z]+).*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(?:) says "don't capture"&lt;/P&gt;

&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2011 10:27:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extraction-regex-problem/m-p/84996#M21663</guid>
      <dc:creator>afaraino</dc:creator>
      <dc:date>2011-04-20T10:27:30Z</dc:date>
    </item>
  </channel>
</rss>

