Skip to content

wrong regexp format output #1147

Closed
Closed

Description

@novathore

Bug report or Feature request?

Bug report

Version (complete output of terser -V or specific git commit)

terser 5.10.0

Complete CLI command or minify() options used

npx terser index.js --format ascii_only --ecma=2017

terser input


console.log(/(^|[^а-яё])([☎☏✆📠📞📱]|т\.|тел\.|ф\.|моб\.|факс|сотовый|мобильный|телефон)(:?\s*?)([+\d(][\d \u00A0\-()]{3,}\d)/gi)

terser output or error


console.log(/(^|[^\u0430-\u044f\u0451])([\u260e\u260f\u2706\u{1f4e0}\u{1f4de}\u{1f4f1}]|\u0442\.|\u0442\u0435\u043b\.|\u0444\.|\u043c\u043e\u0431\.|\u0444\u0430\u043a\u0441|\u0441\u043e\u0442\u043e\u0432\u044b\u0439|\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439|\u0442\u0435\u043b\u0435\u0444\u043e\u043d)(:?\s*?)([+\d(][\d \u00A0\-()]{3,}\d)/gi);

Expected result
input regexp test on string '111111' ->> false
output regexp test on string '111111' ->> true

Activity

  1. artaommahe commented on Feb 16, 2022

    @artaommahe

    (based on this issue angular/angular-cli#22707)

  2. fabiosantoscode commented on Feb 19, 2022

    @fabiosantoscode
    Collaborator

    This seems to be caused by using the \u{hexhexhex} form in RegExps:

    /📞/.test("📞") // => true
    /\ud83d\udcde/.test("📞") // => true
    /\u{1f4de}/.test("📞") // => false
    
  3. fabiosantoscode commented on Feb 19, 2022

    @fabiosantoscode
    Collaborator

    There we go! I'll release this on Monday

  4. added a commit that references this issue on Dec 25, 2024
    c2e550f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions