Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong regexp format output #1147

Closed
novathore opened this issue Feb 16, 2022 · 3 comments
Closed

wrong regexp format output #1147

novathore opened this issue Feb 16, 2022 · 3 comments
Labels

Comments

@novathore
Copy link

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

@artaommahe
Copy link

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

@fabiosantoscode
Copy link
Collaborator

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

/📞/.test("📞") // => true
/\ud83d\udcde/.test("📞") // => true
/\u{1f4de}/.test("📞") // => false

@fabiosantoscode
Copy link
Collaborator

There we go! I'll release this on Monday

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants