Splunk Search

What Is Purpose Of Leading P Argument In Field Extraction Regex?


When extracting a field using a regex, what does the P argument do (the P character between the question mark and the field name)? I have seen examples with and without this argument, but I don't see any obvious difference in the results. For example:
(?i) Finished (?P.+)
(?i) Finished (?.+)

I looked in the Splunk manual and on the Answers site but couldn't find any description of this argument. Apologies if I'm missing something obvious.

Tags (1)
0 Karma


The P was part of the syntax when Python first introduced the idea of naming a capture in regular expressions. However, the P is not part of the syntax in some other flavors of regular expressions, most notably Microsoft .NET.

Splunk supports the syntax both ways.


Great - thanks for the quick response!

0 Karma
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...