Splunk Search

Regex Error - Regex: PCRE does not support \L, \l, \N{name}, \U, or \u

snoobzilla
Builder

A little help needed. Regex below is throwing the error in title of question...

rex field=source "N:\\logs\\(?P<UID>[^_]+)"

The source I am trying to match against has following format...

N:\logs\username_blah.log

Thanks!

Tags (3)
0 Karma
1 Solution

somesoni2
Revered Legend

You need one more backward slash for escape. This works fine with sample value.

|rex field=source "N:\\\logs\\\(?P<UID>[^_]+)"

View solution in original post

0 Karma

somesoni2
Revered Legend

You need one more backward slash for escape. This works fine with sample value.

|rex field=source "N:\\\logs\\\(?P<UID>[^_]+)"
0 Karma

snoobzilla
Builder

Doesn't seem to work with either 2 or 4 backslashes as transform.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

transforms.conf should require only two backslashes.

The rex command takes a string - that string uses backslashes as its escape character, requiring extra backslashes. transforms.conf doesn't take a string in a programming sense, so there's one fewer layer of escaping going on.

0 Karma

somesoni2
Revered Legend

Try with 4 backslashes.

0 Karma

snoobzilla
Builder

That worked inline, thanks!

Any idea how to get this to work in a transform? I get same error when I save transform three slashes and it doesn't work with two.

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...