Splunk Search

How to extract the substring from a string

febbi
Explorer

I want to extract the substring: "xenmobile" from string:  "update task to xenmobile-2021-11-08-19-created completed!", how can I get that?

Labels (1)
0 Karma
1 Solution

isoutamo
SplunkTrust
SplunkTrust
| makeresults
| eval foo = "update task to xenmobile-2021-11-08-19-created completed!"
| rex field=foo "update task to (?<bar>[^-]+)"

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| replace "xenmobile" WITH "" IN field
0 Karma

isoutamo
SplunkTrust
SplunkTrust
| makeresults
| eval foo = "update task to xenmobile-2021-11-08-19-created completed!"
| rex field=foo "update task to (?<bar>[^-]+)"
Get Updates on the Splunk Community!

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2025 SplunkTrust is officially open! If you ...

Splunk Answers Content Calendar, June Edition II

Get ready to dive into Splunk Dashboard panels this week! We'll be tackling common questions around ...

Splunk Observability Cloud's AI Assistant in Action Series: Auditing Compliance and ...

This is the third post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...