regex for testing "\" in string -
this question has answer here:
why regexp returns false for
/[\\]/igm.test('asdasdasd\asdasd');
and true
/[\\]/igm.test('asdasdasd\\asdasd');
and when try gives error, why..?
/[\\]/igm.test('abc\xyz');
\x
character escape ascii character, next 2 characters must hexidecimal digits. so, \xyz
invalid because y , z aren't hex digits.
Comments
Post a Comment