简单教程
提交运行
代码编辑器:
<script> var str="Hello world!"; //查找"Hello" var patt=/Hello/g; var result=patt.exec(str); document.write("返回值: " + result); //查找 "TWLE" patt=/TWLE/g; result=patt.exec(str); document.write("<br>返回值: " + result); </script>
运行结果: