0

i would like to extract text before last item within brackets

|Groupname|

|---------|

|Agile Transformation (FGH)|

|Innovation Lab|

from the raw data below using regex

|Groupname|

|---------|

|Agile Transformation (FGH) (10000)|

|Innovation Lab (10001)|

  • See solutions here: https://stackoverflow.com/questions/23556020/remove-last-occurrence-of-a-string-in-a-string – johnjps111 Jul 12 '22 at 16:49

1 Answers1

0

By using multiline regex and negative lookahead mechanisms, you can extract very last section title and its associated content.

For instance, with:

\|(?<title>[^|\n]+)\|(?!(.|\n)*\|.*\|(.|\n)*)\n?(?<content>(?:.|\n)+)\Z

(try and look detailed explanation here: https://regex101.com/r/pTDlUl/1)

Cheers