regex,alternation,regex-alternation
You can use two regex, the first one can be: - \(\w+\)(composeView\(.*?\)) Working demo Take a look at the Substitution section And the second one: \+ \(\w+\)(composeView\(.*?\)) Working demo ...
python,regex,regex-alternation
In order to capture ${...}, you need to remove ?: to turn non-capturing groups into capturing ones. You can make them named as well. Also [_a-zA-Z0-9] is equal to \w, thus we can shorten your regex a bit: (?P<Alternation1> \$\{(?P<braced>[_a-zA-Z][a-zA-Z0-9]*(?::[_a-zA-Z]\w*)+) \} ) | (?P<Alternation2> \$(?P<named>[_a-zA-Z][a-zA-Z0-9]*(?::[_a-zA-Z]\w*)+ ) ) Have a look...