I have string field "event=[someevent1] ID=[000001] text=[Sample Text 123]"
I need just the part inside text that is Sample Text 123
How to extract this using regex?
I have tried (text=).\*$
but this doesn't work.
I have string field "event=[someevent1] ID=[000001] text=[Sample Text 123]"
I need just the part inside text that is Sample Text 123
How to extract this using regex?
I have tried (text=).\*$
but this doesn't work.
You can use
text=\[([^\]\[]*)
See this regex demo.
Details:
text=\[
- a text=[
substring([^\]\[]*)
- Group 1: zero or more chars other than square brackets.A variation of the pattern with a lookbehind:
(?<=text=\[)[^\]\[]+
It matches one or more chars other than square brackets after text=[
string.