0

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.

The fourth bird
  • 154,723
  • 16
  • 55
  • 70

1 Answers1

0

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.

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563