regularExpressionES2025Syntax.ts(17,38): error TS1515: Named capturing groups with the same name must be mutually exclusive to each other.


==== regularExpressionES2025Syntax.ts (1 errors) ====
    // Pattern modifiers are only available from ES2025.
    const addModifier = /(?i:abc)/;
    const removeModifier = /(?-i:abc)/;
    const addAndRemoveModifiers = /(?i-ms:abc)/;
    
    // A plain non-capturing group is not a pattern modifier and is available at every target.
    const nonCapturingGroup = /(?:abc)/;
    
    // Duplicate named capturing groups are only available from ES2025.
    const duplicateNames = /(?<year>\d{4})-\d{2}|\d{2}\/(?<year>\d{4})/;
    const duplicateNamesWithReference = /(?<a>x)\k<a>|(?<a>y)/;
    
    // Named capturing groups that are not duplicated remain available from ES2018.
    const distinctNames = /(?<a>x)|(?<b>y)/;
    
    // Duplicate names within the same alternative are an error at every target.
    const sameAlternative = /(?<dup>x)(?<dup>y)/;
                                         ~~~
!!! error TS1515: Named capturing groups with the same name must be mutually exclusive to each other.
    