I am new to JavaScript.
Therefore, I don't understand how the following javascript code work:
var specialChars="/\\(\\)><@,;:\\\\\\\"\\.\\[\\]\*\+\?\!\#\$\%\^\&\=\~\`\|\/\'";
var validChars="\[^\\s" + specialChars + "\]";
var atom=validChars + '+';
var atomPat=new RegExp("^" + atom + "$");
var str = "Hello World!";
if (str.search(atomPat)==-1)
{
alert ("Special Characters Found!");
}
When the code run, it will prompt the alert message, which I don't understand why.:-/
Could someone please kindly explain.
Thanks.:)