Skip to content

Conversation

@chirsz-ever
Copy link

I choose to transform regular expression literals to new RegExp calls instead of only to replace the non-ASCII characters to escape sequence, because the latter will change the return value of tostring of the created regular expression.

> /π/.toString()
'/π/'
> /\u03C0/.toString()
'/\\u03C0/'
> new RegExp('\u03C0').toString()
'/π/'

@chirsz-ever chirsz-ever changed the title feat: escape non-ASCII characters embedded in regular expressions feat: transform regular expression literals containing non-ASCII characters Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant