Have extractAll() return $1 values

I’m running the following RegEx in extract all extractAll("\[(@.*?)\]"). Is there a way to have extractAll() return the $1 rather than the $0 value, i.e, the value between the ( )?

If you just want to find the @.*? pattern you might try

(?<=\[)@.*?(?=\])

which will ignore the opening and closing brackets.

Or even this

@[^]]*

which just finds the @... strings, makes sure to only include strings that have a closing bracket, and ignores the closing bracket in the output.

1 Like

Great suggestion! Thanks. :slight_smile: