i using below code match words in comma separated string
<script> var str="testdata, w3\standard,"; var patt=/\bw3\\standard/g; document.write(str.match(patt) ); </script>
but not give me result though escape string in regular expression. on
the string doesn't have \
character in since starts escape sequence when use in string literals.
you have escape character in original string literal:
var str="don't visit awful w3\\schools,"; var patt1=/\bw3\\schools/g; document.write(str.match(patt1));
Comments
Post a Comment