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

/u flag vs. /v flag #55

Closed
rauschma opened this issue Oct 21, 2022 · 3 comments
Closed

/u flag vs. /v flag #55

rauschma opened this issue Oct 21, 2022 · 3 comments

Comments

@rauschma
Copy link

There is no way of escaping that works in all scenarios:

[<] [\<]
Neither /u nor /v
/u
/v

What’s the best approach then? Only support /v?

More information: tc39/proposal-regexp-v-flag#71

@lionel-rowe
Copy link
Contributor

For completeness — I know it's been discussed in other issues as a solution to various issues of context-sensitivity, though it's suboptimal in terms of conciseness and readability:

[<] [\<] [\x3c]
Neither /u nor /v
/u
/v

@bakkot
Copy link
Collaborator

bakkot commented Mar 13, 2023

One option (mentioned elsewhere and elsewhere) is to just make all of those escapes legal (as identity escapes) in u-mode regexes. I think that's the easiest - we wouldn't want to give those different meanings than in v-mode, I think.

@eemeli
Copy link
Member

eemeli commented Sep 19, 2023

It seems like adding a second flags argument to RegExp.escape() would provide a pretty ergonomic solution (as in the RegExp constructor), if there are differences in required escapes.

@ljharb ljharb mentioned this issue Sep 26, 2023
32 tasks
@ljharb ljharb closed this as completed in 9c55324 Oct 12, 2023
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

No branches or pull requests

4 participants