Hi Community,
I want to split a string like 1stString_2ndString_3rdString_4rdString_5thString using the RegexMatch function for GQI column manipulation.
The string values are variable, underscores are fixed as a separator.
Let's say I only need the 3rdString for a column.
It looks like it is not possible to use capturing groups and work with "$3" at the end of the regex.
The image is from regex101 for better explanation
How can I extract this value?
Hi Felix,
I believe you can use regex Lookahead and Lookbehind assertions (Lookahead assertion: (?=...), (?!...) - JavaScript | MDN (mozilla.org))
In your case, an expression that can work is (?<=1stString_2ndString_)3rdString(?=_4rdString_5thString)
Another option is creating your own custom operator that separates the text into different columns. See docs: Configuring a custom operator for a query | DataMiner Docs
Hi Sebastian,
thanks, your tip helped me to find a regex solution.
(?<=\B.*_\B.*_)\B.*(?=_\B.*_\B.*) works fine