[Webkit-unassigned] [Bug 272546] New: Incorrect regex replacement for \p{Emoji}

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Apr 11 13:29:59 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=272546

            Bug ID: 272546
           Summary: Incorrect regex replacement for \p{Emoji}
           Product: WebKit
           Version: Safari 17
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ocavue at gmail.com

I found a difference in regex behavior between Safari and Chrome/Firefox.

Copy and paste the following code into devtools:

```js
const s = "��".replace(/^[^\p{Emoji}]+|[^\p{Emoji}]+$/u, "")
console.log(s)
for (let i = 0; i < s.length; i++) {
  console.log(s.codePointAt(i))
}
```

Both Chrome and Firefox output the result below:

```
��
127822
57166
```

However Safari outputs:

```

55356
```

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240411/bf06982a/attachment.htm>


More information about the webkit-unassigned mailing list