正则表达式:/^([A-Za-z0-9]{8,20})$ function containSpecial(s){ var isSpecialCharacter;var reg = /^[a-zA-Z0-9_-]/;if(reg.test(s)){isSpecialCharacter = false;}else{isSpecialCharacter = true;}return isSpecialCharacter;}