Splunk Enterprise

Why does my rex not work on splunk?

SplunkEmp22
Engager

Hi, i don't know where is the problem. The search it's:

| rex '(?<field>H.+)\\'

| table field

I want to use regular express. for parsing field and i want to show in output the result.  The field got a path like \Pc\Hardware\Nice\ok . I want to get all of the words after Pc\. 

I don't know how to solve, he literaly does nothing and return the same origin data.

Thank u

Labels (1)
Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

You have to double-up on backslashes in Splunk regex - compared to something that works in regex101.com for example

| rex "(?<field>H.+)\\\\"

View solution in original post

SplunkEmp22
Engager

Top bro. I'm learning from regex101, so i didn't know that. Thank u man

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You have to double-up on backslashes in Splunk regex - compared to something that works in regex101.com for example

| rex "(?<field>H.+)\\\\"
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...