匹配任何包含 N 个 p 序列的字符串
htmljavascriptprogramming scripts更新于 2024/6/5 21:00:17
要使用 JavaScript RegExp 匹配任何包含 N 个 p 序列的字符串,请使用 p{N} 量词。
示例
您可以尝试运行以下代码来匹配任何包含 N 个 p 序列的字符串 −
<html>
<head>
<title>JavaScript 正则表达式</title>
</head>
<body>
<script>
var myStr = "Welcome 1, 100, 10000, 1000";
var reg = /\d{3}/g;
var match = myStr.match(reg);
document.write(match);
</script>
</body>
</html>
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

