javascript正则表达式实例

1 字符串包含连续N个数字 <script type= "text javascript "> function check(){ str = a value ;

1.字符串包含连续N个数字

<script type="text/javascript">
function check(){
str = a.value ;
var pattern = /\d{6}/;
alert(pattern.test(str));
}
</script>
<input id="a" name="a" type="text" value="455sdfs55454545dgdf5" /><input type="button" value="检查" onclick="check();" />

标签: