I’m trying to use a regex to get the last word within the parentheses if there is more than 1 word inside. In all cases will be Baz
! KEYWORD (\Foo \Bar \Ban \Baz) "/" "Hello"
! KEYWORD (\Foo \Bar \Baz) "/" "Hello"
! KEYWORD (\Foo \Baz) "/" "Hello"
Thanks
One possibility would be
Explanation
This regex works because it actively uses backtracking to find “the last occurrence of something” in a string (i.e. step #2 is repeated until the rest of the expression can match – or the entire expression fails).
In this case something is a sequence of word characters preceded by a non-word character and followed by a closing paren.