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

Use alternative styling for \n and \r in subject text to indicate what's going on #17

Open
slevithan opened this issue Oct 12, 2021 · 0 comments

Comments

@slevithan
Copy link
Contributor

slevithan commented Oct 12, 2021

Personally, I like the current magical handling of treating \n and \r in the subject text as literal LF and CR characters when searching for matches. However, it's non-obvious and only works for these two tokens (and not others supported by JS string literals like \\, \t, \v, \f, \b, \xFF, etc.). Therefore, most people are likely to initially expect that the regex \\n should match \n in the subject text (it doesn't).

(Aside: because of the current handling, there is no way to make a regex of \\n match anything. It won't match \n or \\n because \\ is not given the same magic handling in the subject text and therefore, for subject text \\n, the string is considered to be \ followed by a literal LF.)

Proposal: Apply special styling to \n and \r wherever they appear in the subject text, or alternatively, automatically convert them to the characters (U+240A) and (U+240D) as soon as they're typed in the subject text, then apply the magical match handling to and .

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

1 participant