Bug 176814 - String.prototype.replace() puts extra '<' in result when a named capture reference is used without named captures in the RegExp
Summary: String.prototype.replace() puts extra '<' in result when a named capture refe...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Michael Saboff
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-09-12 16:43 PDT by Michael Saboff
Modified: 2022-09-07 08:27 PDT (History)
6 users (show)

See Also:


Attachments
Patch (4.25 KB, patch)
2017-09-12 16:54 PDT, Michael Saboff
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Saboff 2017-09-12 16:43:50 PDT
According to the named capture proposed spec changes, when the string "$<" is seen in the replacement string but the search RegExp doesn't contain any named groups, "$<" should be copied to the output.  See step 1 for the "$<" row in Table 1of the proposal (https://tc39.github.io/proposal-regexp-named-groups/#table-45).  Currently we are copying "$<<".
Comment 1 Radar WebKit Bug Importer 2017-09-12 16:44:21 PDT
<rdar://problem/34399809>
Comment 2 Michael Saboff 2017-09-12 16:54:58 PDT
Created attachment 320582 [details]
Patch
Comment 3 Mark Lam 2017-09-12 17:18:18 PDT
Comment on attachment 320582 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=320582&action=review

LGTM

> Source/JavaScriptCore/ChangeLog:8
> +        The copy and advance indecies where off by one and needed a little fine tuning.

typo:/indecies/indices/
Comment 4 Michael Saboff 2017-09-12 17:20:38 PDT
Committed r221949: <http://trac.webkit.org/changeset/221949>