<?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>249146</bug_id>
          
          <creation_ts>2022-12-12 07:09:49 -0800</creation_ts>
          <short_desc>Regular expression fails in WebKit only: invalid group specifier name</short_desc>
          <delta_ts>2022-12-18 21:32:56 -0800</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 16</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>174931</dup_id>
          
          <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="Vladimir Prelovac">vprelovac</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <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>1918481</commentid>
    <comment_count>0</comment_count>
    <who name="Vladimir Prelovac">vprelovac</who>
    <bug_when>2022-12-12 07:09:49 -0800</bug_when>
    <thetext>The following regular expression works in Chrome and Firefox,  but fails in WebKit:

let tokens = &quot;test&quot;.match(/(?&lt;=\s+|^)[&quot;&apos;‘“&apos;&quot;[({⟨]?(.*?[.?!])(\s[.?!])*[&quot;&apos;’”&apos;&quot;\])}⟩]?(?=\s+|$)|(?&lt;=\s+|^)\S(.*?[.?!])(\s[.?!])*(?=\s+|$)/g);

SyntaxError: Invalid regular expression: invalid group specifier name</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1920088</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-12-16 15:02:31 -0800</bug_when>
    <thetext>&lt;rdar://problem/103461779&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1920096</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2022-12-16 15:30:28 -0800</bug_when>
    <thetext>This was fixed with commit 257823@main (46e6b3f97425): &lt;https://commits.webkit.org/257823@main&gt;.

*** This bug has been marked as a duplicate of bug 174931 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1920165</commentid>
    <comment_count>3</comment_count>
    <who name="Vladimir Prelovac">vprelovac</who>
    <bug_when>2022-12-16 18:48:57 -0800</bug_when>
    <thetext>(In reply to Michael Saboff from comment #2)
&gt; This was fixed with commit 257823@main (46e6b3f97425):
&gt; &lt;https://commits.webkit.org/257823@main&gt;.
&gt; 
&gt; *** This bug has been marked as a duplicate of bug 174931 ***

I&apos;ve compiled trunk with the patch in and want to report that this problem is still not fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1920166</commentid>
    <comment_count>4</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2022-12-16 18:54:27 -0800</bug_when>
    <thetext>(In reply to Vladimir Prelovac from comment #3)
&gt; &gt; *** This bug has been marked as a duplicate of bug 174931 ***
&gt; 
&gt; I&apos;ve compiled trunk with the patch in and want to report that this problem
&gt; is still not fixed.

Are you sure you&apos;re building the latest trunk?  I just tried against trunk also, and I also no longer see that SyntaxError.  Looks fixed to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1920168</commentid>
    <comment_count>5</comment_count>
    <who name="Vladimir Prelovac">vprelovac</who>
    <bug_when>2022-12-16 18:59:06 -0800</bug_when>
    <thetext>(In reply to Mark Lam from comment #4)
&gt; (In reply to Vladimir Prelovac from comment #3)
&gt; &gt; &gt; *** This bug has been marked as a duplicate of bug 174931 ***
&gt; &gt; 
&gt; &gt; I&apos;ve compiled trunk with the patch in and want to report that this problem
&gt; &gt; is still not fixed.
&gt; 
&gt; Are you sure you&apos;re building the latest trunk?  I just tried against trunk
&gt; also, and I also no longer see that SyntaxError.  Looks fixed to me.

Thanks for double checking. I did indeed pull the trunk an hour ago and verified it is latest trunk by verifying the patch was applied. (for example Source/JavaScriptCore/runtime/RegExp.cpp line 252 is &quot; &amp;&amp; !pattern.m_containsLookbehinds&quot;) The Webkit version also shows as 615.1.15+

Then I went to https://runjs.co (since don&apos;t have inspector in minibrowser/run-safari) and ran:

let tokens = &quot;test&quot;.match(/(?&lt;=\s+|^)[&quot;&apos;‘“&apos;&quot;[({⟨]?(.*?[.?!])(\s[.?!])*[&quot;&apos;’”&apos;&quot;\])}⟩]?(?=\s+|$)|(?&lt;=\s+|^)\S(.*?[.?!])(\s[.?!])*(?=\s+|$)/g);

Producing:
SyntaxError: Invalid regular expression: invalid group specifier name</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1920172</commentid>
    <comment_count>6</comment_count>
    <who name="Vladimir Prelovac">vprelovac</who>
    <bug_when>2022-12-16 19:09:38 -0800</bug_when>
    <thetext>My bad, run-minibrowser does not produce error, run-safari does, so I will assume that the problem is on my end. Thanks.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>