var reg=/^\w*$/; if(!reg.test("ddddd..x,cvxv#%^&")) alert("有特殊符号"); else alert("无特殊符号");
要加上<SCRIPT></SCRIPT> <script> var reg=/^\w*$/; if(!reg.test("ddddd..x,cvxv#%^&")) alert("有特殊符号"); else alert("无特殊符号"); </script>
来自于php文档 <?php $mystring = 'abc'; $findme = 'a'; $pos = strpos($mystring, $findme);if ($pos === false) { echo "The string '$findme' was not found in the string '$mystring'"; } else { echo "The string '$findme' was found in the string '$mystring'"; echo " and exists at position $pos"; }?>
eregi(); --不区分大小写
ereg(); --区分大小写
eregi(); --不区分大小写
if(!reg.test("ddddd..x,cvxv#%^&"))
alert("有特殊符号");
else
alert("无特殊符号");
<script>
var reg=/^\w*$/;
if(!reg.test("ddddd..x,cvxv#%^&"))
alert("有特殊符号");
else
alert("无特殊符号");
</script>
<?php
$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);if ($pos === false) {
echo "The string '$findme' was not found in the string '$mystring'";
} else {
echo "The string '$findme' was found in the string '$mystring'";
echo " and exists at position $pos";
}?>