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

I think the 'control char' escapes such as \ca are not handled correctly #104

Open
anentropic opened this issue Apr 30, 2020 · 0 comments
Open
Labels

Comments

@anentropic
Copy link

anentropic commented Apr 30, 2020

JS regex flavour defines a set of escape codes prefixed with \c:

\cX: Matches a control character using caret notation, where "X" is a letter from A–Z (corresponding to codepoints U+0001–U+001F). For example, /\cM/ matches "\r" in "\r\n".

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
https://www.ecma-international.org/ecma-262/5.1/#sec-15.10.1

Another example:

/\ca/.test('\u0001')
-> true

But currently it seems like RandExp treats \ca as "escaped c followed by a":

new RandExp(/\ca/).gen()
-> "ca"

/\ca/.test("ca")
-> false
@fent fent added the bug label Jan 24, 2022
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

2 participants