regexr
regexr copied to clipboard
Incorrect explanation for duplicate groups
For this expression: (?|a(b)(c))\2, (b) is the first captured group, while (c) is the second captured group. This expression would match abcc. However, the explanation given by regexr says that both are capturing group 1, and indicates that group 2 does not exist. This is not consistent with PCRE rules.
For reference: https://regexr.com/61jrr
It looks like our parser isn't handling branch reset groups (?|...) correctly - it's resetting on each group, instead of on a |.
i know why it is happening main reason for this happening as per you stated """ For this expression: (?|a(b)(c))\2, (b) is the first captured group, while (c) is the second captured group. This expression would match abcc. However, the explanation given by regexr says that both are capturing group 1, and indicates that group 2 does not exist. This is not consistent with PCRE rules.""" but it can although fit easily so don't worry it problem continues then let me know i will handle Best Luck 👍