<?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 extractions what is the difference between (?P.+) and (?.+)? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-what-is-the-difference-between-P-and/m-p/52880#M12869</link>
    <description>&lt;P&gt;When I extract Fields from a source/sourcetype through Splunk web using the "Extract Fields" context menu on an event. Splunk seems to generate a regex that conatins an uppercase P before the fieldname. Does anyone know what this does?&lt;/P&gt;

&lt;P&gt;Are those equivalent?&lt;BR /&gt;&lt;BR /&gt;
(?&lt;STRONG&gt;P&lt;/STRONG&gt;&amp;lt;field_name&amp;gt;.+) and  (?&amp;lt;field_name&amp;gt;.+)?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 12:23:23 GMT</pubDate>
    <dc:creator>chris</dc:creator>
    <dc:date>2020-09-28T12:23:23Z</dc:date>
    <item>
      <title>Field extractions what is the difference between (?P.+) and (?.+)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-what-is-the-difference-between-P-and/m-p/52880#M12869</link>
      <description>&lt;P&gt;When I extract Fields from a source/sourcetype through Splunk web using the "Extract Fields" context menu on an event. Splunk seems to generate a regex that conatins an uppercase P before the fieldname. Does anyone know what this does?&lt;/P&gt;

&lt;P&gt;Are those equivalent?&lt;BR /&gt;&lt;BR /&gt;
(?&lt;STRONG&gt;P&lt;/STRONG&gt;&amp;lt;field_name&amp;gt;.+) and  (?&amp;lt;field_name&amp;gt;.+)?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:23:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-what-is-the-difference-between-P-and/m-p/52880#M12869</guid>
      <dc:creator>chris</dc:creator>
      <dc:date>2020-09-28T12:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions what is the difference between (?P.+) and (?.+)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-what-is-the-difference-between-P-and/m-p/52881#M12870</link>
      <description>&lt;P&gt;i am not sure it does anything special...outside pointing to perl or python:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;name&amp;gt;pattern) - Named group (Perl)

(?P&amp;lt;name&amp;gt;pattern) - Named group (Python)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Named groups appears to be a Python-specific extension to regex.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2012 11:25:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-what-is-the-difference-between-P-and/m-p/52881#M12870</guid>
      <dc:creator>MarioM</dc:creator>
      <dc:date>2012-09-06T11:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions what is the difference between (?P.+) and (?.+)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-what-is-the-difference-between-P-and/m-p/52882#M12871</link>
      <description>&lt;P&gt;Makes sense&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2012 11:38:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-what-is-the-difference-between-P-and/m-p/52882#M12871</guid>
      <dc:creator>chris</dc:creator>
      <dc:date>2012-09-06T11:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Field extractions what is the difference between (?P.+) and (?.+)?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-extractions-what-is-the-difference-between-P-and/m-p/52883#M12872</link>
      <description>&lt;P&gt;For capturing groups - there is no real difference &lt;/P&gt;

&lt;P&gt;given the string : &lt;CODE&gt;"&amp;lt;data&amp;gt;stuff&amp;lt;/data&amp;gt;"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You can do this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "&amp;lt;(?&amp;lt;node&amp;gt;[^&amp;gt;]+)&amp;gt;(?&amp;lt;text&amp;gt;.*?)&amp;lt;/(?P=node)&amp;gt;"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This : &lt;CODE&gt;(?P=node)&lt;/CODE&gt; is a string replacement for 'data' which was previously captured in the group named 'node'&lt;/P&gt;

&lt;P&gt;So we're making sure that in the xml snippet, the closing tag contains the same tag that opened the xml node.&lt;/P&gt;

&lt;P&gt;In non-jargon...&lt;/P&gt;

&lt;P&gt;node = everything betwenn the &amp;lt; and the next &amp;gt;&lt;BR /&gt;&lt;BR /&gt;
text = everything between &lt;CODE&gt;&amp;lt;node&amp;gt;&lt;/CODE&gt; and the next instance of &lt;CODE&gt;&amp;lt;/node&amp;gt;&lt;/CODE&gt; (whatever string 'node' might be)&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2012 21:09:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-extractions-what-is-the-difference-between-P-and/m-p/52883#M12872</guid>
      <dc:creator>jonuwz</dc:creator>
      <dc:date>2012-09-06T21:09:42Z</dc:date>
    </item>
  </channel>
</rss>

