简单教程
提交运行
代码编辑器:
<!DOCTYPE html> <meta charset="utf-8"> <title>正则表达式 | 简单教程 ( www.twle.cn )</title> <script> var str = "Is is the cost of of gasoline going up up"; var patt1 = /\b([a-z]+) \1\b/ig; document.write(str.match(patt1)); </script>
运行结果: