Splunk Search

Does SEDCMD use PCRE regular expressions?

gkanapathy
Splunk Employee
Splunk Employee

I know that in general, regular expressions in Splunk use PCRE (or a modified PCRE for matching in props.conf source stanza headings). If I set SEDCMD in props.conf, e.g.:

SEDCMD-example = s/regex/subst/g

is the regex also PCRE? Standard sed uses grep or egrep regexes, not PCRE, so this isn't entirely clear.

Tags (2)
1 Solution

Ledion_Bitincka
Splunk Employee
Splunk Employee

SEDCMD uses PCRE regex and thus is equivalent to sed -r

props.conf.spec
SEDCMD-<class> = <sed script>
....
* Syntax:
 * replace    - s/regex/replacement/flags
  * where regex is a perl regex (optionally containing capturing groups)
  * replacement is a string to replace the regex match, use \N for backreferences
  * flags can be either: g to replace all matches or a number to replace a specified match
 * substitute - y/string1/string2/
  * substitutes the string1[i] with string2[i]

View solution in original post

Ledion_Bitincka
Splunk Employee
Splunk Employee

SEDCMD uses PCRE regex and thus is equivalent to sed -r

props.conf.spec
SEDCMD-<class> = <sed script>
....
* Syntax:
 * replace    - s/regex/replacement/flags
  * where regex is a perl regex (optionally containing capturing groups)
  * replacement is a string to replace the regex match, use \N for backreferences
  * flags can be either: g to replace all matches or a number to replace a specified match
 * substitute - y/string1/string2/
  * substitutes the string1[i] with string2[i]
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...