js 的正则表达式 部分展示test()方法的验证功能

Posted jerryhe326

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js 的正则表达式 部分展示test()方法的验证功能相关的知识,希望对你有一定的参考价值。

 

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<script>
var patt1=new RegExp("^[1-9][0-9]*$");
document.write(patt1.test("1000"));
</script>

</body>
</html>

匹配非零整数,成功返回true,失败返回false。

以上是关于js 的正则表达式 部分展示test()方法的验证功能的主要内容,如果未能解决你的问题,请参考以下文章