My ESlint throws the error
Unexpected control character(s) in regular expression: \x08 no-control-regex
for my regular expression
let regex = new RegExp("^[0-9a-zA-Z \b]+$");
If i remove \b
from my regEx the error is not thrown. Why is this happening? How can i remove the error?
\b
in there is perfectly valid (though, how would you get a string that includes the backspace character?)\s
should also match backspace. Actually, I'm not sure backspace is an actual character, and it should be noted that\b
is a word boundary, not a character.\b
you should probably disable this ESLint rule that is set by default eslint.org/docs/rules/no-control-regex\b
inside a character class is seen as the backspace character (\x08).how would I get a string that includes the backspace character
- did you want a backspace in a string? or do you mean how do you get a backspace into a regexp