Splunk Search

rex giving unrecognized character

shobhitdesh
New Member

Regular expression

 "ParNew:" | rex "(?i)\\), (?P[^ ]+)" | rex "(?i).*?\\((?P\\d+\\w+)(?=\\))" | rex "(?i)\\[ParNew: (?P[^\\-]+)" | rex "(?i)\\->(?P[^\\(]+)" | table COLLECTION_TIME, HEAP_SIZE_AVAILABLE, OBJECT_SIZE_BEFORE_GC, OBJECT_SIZE_AFTER_GC 

gives error in 'rex' command: Encountered the following error while compiling the regex '(?i)), (?P[^ ]+)': Regex: unrecognized character after (?P

Tags (2)
0 Karma

mstjohn_splunk
Splunk Employee
Splunk Employee

hi @shobhitdesh

Did any of the answers or comments below solve your problem? If so, please resolve this post by approving it!

If your problem is still not solved, keep us updated so that someone else can help ya.

Thanks for posting!

0 Karma

DalJeanis
Legend

Your query should have a field name in angle brackets after the (?P, and the P is unneeded. ... so something like (?<fieldname>.*)

0 Karma

inventsekar
SplunkTrust
SplunkTrust

as @richgalloway said, the rex query got damaged..
maybe you can update a screenshot your error when you run this cmd on screen on your splunk web GUI
or, put your rex query inside backticks (something)

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The system mangled your regex so it's difficult to see what may be wrong.
Please edit or comment with the regex string inside backtick characters so it's displayed fully.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...