javascript pattern只允许数字,英文字母和一些特殊字符 博客分类: Java编程PHP编程Web前端开发 HTMLWebJavaScriptjQuery
程序员文章站
2024-02-20 17:56:34
...
<script type="text/javascript"> var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; var chPattern = /^[A-Za-z0-9 \!\@\#\$\^\&\*\-\_\+\=\:\\\'\;\,\.\/\?\(\)\{\}\[\]\<\>]*$/; var s = "yang Hua Jie qwe231@[]"; alert(chPattern.test(s) ); </script>