user1054158
user1054158

Reputation:

About the names of groups

Is it risky to uses such kind of pattern (?P<gp1>...(?P<subgpA>...)...)|(?P<gp2>...(?P<subgpA>...)...) where I use the same name for subgroups in different first level groups in an alternative ?

For the names of the first level groups, they would be all different.

Upvotes: 0

Views: 71

Answers (1)

Explosion Pills
Explosion Pills

Reputation: 191749

Not so much risky as impossible. Try using that code in a pattern.

sre_constants.error: redefinition of group name 'subgpA' as group 4; was group 2

Upvotes: 1

Related Questions