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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...