
匹配任何指定的替代方案,请按照下面给出的模式−
(foo|bar|baz)
示例
您可以尝试运行以下代码来查找任何替代文本 −
<html>
<head>
<title>JavaScript Regular Expression</title>
</head>
<body>
<script>
var myStr = "one,one,one, two, three, four, four";
var reg = /(one|two|three)/g;
var match = myStr.match(reg);
document.write(match);
</script>
</body>
</html>

