Skip to content

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

Description

@anentropic

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions