Splunk Search

Regular expression for a pattern

xvxt006
Contributor

Hi we have some uri's as shown below which have 2 words (/verify/abrasives) before /ecatalog and 3 words and 4 words. I want to get the uri's only after /ecatalog

/verify/abrasives/ecatalog/N-bi1/Ntt-3M+Abrasives
/verify/bearings/power-transmission/ecatalog/N-aoj
/verify/abrasive-cut-on/power-saws-and-accessories/power-tools/ecatalog/N-caiZ1z0d6at

i have tried like this but it did not give me proper results. Any suggestions?

Base search | rex field=uri_path ".*?(?[^(?:/ecatalog)]+)"

Tags (1)
0 Karma

somesoni2
Revered Legend

Try this

Your base search| rex field=uri "/ecatalog(?<custom>.*)" 
0 Karma

richgalloway
SplunkTrust
SplunkTrust

This worked for me on RegExr using your sample data.

rex field=uri_path "(?<custom>(\/verify[\/[\S]*))\/ecatalog"
---
If this reply helps you, Karma would be appreciated.
0 Karma

xvxt006
Contributor

Thanks. This gives me before /ecatalog. I want the part which is after ecatalog.

0 Karma
Get Updates on the Splunk Community!

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

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 ...