匹配包含零个或多个p的任何字符串。
要将任何包含零个或多个p的字符串与JavaScriptRegExp匹配,请使用p*量词。
示例
您可以尝试运行以下代码以匹配包含零个或多个p的任何字符串。在这里,p被认为是出现次数-
<html>
<head>
<title>JavaScript Regular Expression</title>
</head>
<body>
<script>
var myStr = "Welcome! Wweeeelcome to our website!";
var reg = /el*/g;
var match = myStr.match(reg);
document.write(match);
</script>
</body>
</html>