x
 
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript 正则表达式</h1>
<p>在字符串中搜索字符 "THIS":</p>
<p id="demo"></p>
<script>
let text = "THIS This this";
let result1 = text.match(/[THIS]/g);
let result2 = text.match(/[THIS]/gi);
document.getElementById("demo").innerHTML =
result1 + "<br>" +result2;
</script>
</body>
</html>