For example: var regVal = '\w ';
How to know if it contains a backslash?
/\/.test(regVal);
In addition, your regVal assignment may not achieve the purpose. The backslashes in the string literal must be escaped:
regVal
var regVal = "\w+";
In addition, your
regVal
assignment may not achieve the purpose. The backslashes in the string literal must be escaped: