x
 
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript RegExp</h2>
<p>exec() 方法测试(检索)字符串中的匹配项:</p>
<p>在字符串中搜索字符 "e":</p>
<p id="demo"></p>
<script>
let text = "The best things in life are free";
let result = /e/.exec(text);
document.getElementById("demo").innerHTML = result;
</script>
</body>
</html>