Mailbox Verification
| The code is as follows |
Copy Code |
var re =/^[_a-za-z0-9-.] +@ ([-_a-za-z0-9]+.) +[a-za-z0-9]{2,3}$/; if (!thisinput.value.match (re)) { Regemailinfo.classname = "Show err"; regemailinfo.innerhtml = "Input does not conform to specification"; } |
Filter spaces and
| The code is as follows |
Copy Code |
String.prototype.trim = function () { Return This.replace (/(^s*) | ( s*$)/g, ""); } |
Regular Chinese characters
| The code is as follows |
Copy Code |
Count string byte number, return integer String.prototype.ByteCount = function () { TXT = this.replace (/(<.*?>)/ig, ""); TXT = txt.replace (/([u0391-uffe5])/ig, "11"); var count = txt.length; return count; } |
User name Verification
| code is as follows |
copy code |
| var re =/^[ a-za-z1-9_]{6,20}$/; if (!thisinput.value.match (re) { Reguserinfo.classname = "Show err"; reguserinfo.innerhtml = "Input does not conform to specification"; } |