console.log(/^\\[Xx][a-z][0-9]/.test('\xd8'));
Asked
Active
Viewed 38 times
-3

rollstuhlfahrer
- 3,988
- 9
- 25
- 38

jhondoe144
- 1
- 2
-
$20 says that this is an [XY problem](http://xyproblem.info/). – JJJ Mar 02 '18 at 16:00
-
how can i fix it ?? – jhondoe144 Mar 02 '18 at 16:01
1 Answers
2
\x
is an escape sequence for other cases. \xd8
is the escaped value for Ø
.
This means, your regex test never saw any of those characters you entered. Therefore the result has to be false
.
If you want to match those strings, you need to escape the basckslash:
a = '\\xd8';
console.log(/^\\[Xx][a-z][0-9]/.test(a));

rollstuhlfahrer
- 3,988
- 9
- 25
- 38
-
-
the pobleme is \xd8 is what i get from raw html data after scrapping a website . – jhondoe144 Mar 02 '18 at 16:23