Splunk Search

How to extract the string which is between the two different special characters using regex

SureshkumarD
Explorer

Hi Team,

I need to extract the string which is between the two different special characters using regex. Could you please assist on this? Thank you. Here is the string below where I need to extract the string provisionById which is between the semicolon and period charcter.

Method End: com.bi.gb.rest.endpoint.PolicyAdminEndPoint.provisionById;  Execution Time: 7

Labels (1)
0 Karma
1 Solution

dtburrows3
Builder

This line works for this specific example 

| rex field=_raw "\.(?<extacted_fieldname_here>\w+);"


Assuming that your targeted extraction field always lies between the period and semi-colon I think it should do it.

dtburrows3_0-1718055318436.png

the "\w+" could potentially need to be change depending on what the characters are between the 2 special characters. But for this example it looks to be camelCase so \w+ should work.

 

View solution in original post

dtburrows3
Builder

This line works for this specific example 

| rex field=_raw "\.(?<extacted_fieldname_here>\w+);"


Assuming that your targeted extraction field always lies between the period and semi-colon I think it should do it.

dtburrows3_0-1718055318436.png

the "\w+" could potentially need to be change depending on what the characters are between the 2 special characters. But for this example it looks to be camelCase so \w+ should work.

 

SureshkumarD
Explorer

Hi @dtburrows3 ,

Thank you for your prompt response and it worked. Really appreciate your assistance.

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In November, the Splunk Threat Research Team had one release of new security content via the Enterprise ...

Index This | Divide 100 by half. What do you get?

November 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Stay Connected: Your Guide to December Tech Talks, Office Hours, and Webinars!

❄️ Celebrate the season with our December lineup of Community Office Hours, Tech Talks, and Webinars! ...