I have the following regular expression (Python) that I don't understand at the following point. Why doesn't it match the first alternation, too?
Regex (spaced for better understanding):
(?:
\$\{
(?P<braced>
[_a-zA-Z][a-zA-Z0-9]*(?::[_a-zA-Z][_a-zA-Z0-9]*)+
)
\}
)
| ### SECOND ALTERNATION ###
(?:
\$
(?P<named>
[_a-zA-Z][a-zA-Z0-9]*(?::[_a-zA-Z][_a-zA-Z0-9]*)+
)
)
Test String:
asdasd $asd:sd + ${asd123:asd} $HOME $$asd
Matched stuff:
asdasd $asd:sd + ${asd123:asd} $HOME $$asd
According to the regex pattern above, the first alternation should also appear, namely:
${asd123:asd}
It seems I don't quite get the alternation pattern?