JavaScript RegExp可以用来查找其他替代文本?
要匹配任何指定的替代方案,请遵循以下给出的模式-
(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>