<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>272659</bug_id>
          
          <creation_ts>2024-04-15 00:05:51 -0700</creation_ts>
          <short_desc>Nested duplicate named capturing groups in regex is not syntax error</short_desc>
          <delta_ts>2024-04-24 09:43:28 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>Safari 17</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>macOS 14</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="ota-meshi-biz">y.ohta.z3</reporter>
          <assigned_to name="Michael Saboff">msaboff</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>karlcow</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2028440</commentid>
    <comment_count>0</comment_count>
    <who name="ota-meshi-biz">y.ohta.z3</who>
    <bug_when>2024-04-15 00:05:51 -0700</bug_when>
    <thetext>When I run the following two regexes in Safari&apos;s JavaScript console, one gives a syntax error, but the other does not:

But I expected both to result in a syntax error.

```js
/(?:(?&lt;x&gt;a)|(?&lt;x&gt;b))(?&lt;x&gt;c)/; // not syntax error?
/(?&lt;x&gt;c)(?:(?&lt;x&gt;a)|(?&lt;x&gt;b))/; // syntax error
```

I think they should both be syntax errors, since they&apos;re just swapped around. What do you think?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2030220</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-04-22 08:54:27 -0700</bug_when>
    <thetext>&lt;rdar://problem/126863735&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2030322</commentid>
    <comment_count>2</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-04-22 13:34:22 -0700</bug_when>
    <thetext>It is reproducible in WebKit ToT as well and Chrome Canary 125 and Firefox Nightly 127 both throw &apos;syntax&apos; error for first one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2030479</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2024-04-23 01:13:25 -0700</bug_when>
    <thetext>I believe the first one should also be a syntax error.  Investigating.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2030815</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2024-04-24 00:34:19 -0700</bug_when>
    <thetext>Testing a fix now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2030829</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2024-04-24 02:49:19 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/27681</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2030896</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-04-24 09:43:26 -0700</bug_when>
    <thetext>Committed 277928@main (93db8886b0d3): &lt;https://commits.webkit.org/277928@main&gt;

Reviewed commits have been landed. Closing PR #27681 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>