W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h2>JavaScript 字符串搜索</h2> <p>在字符串中搜索 "ain":</p> <p id="demo"></p> <script> let text = "The rain in SPAIN stays mainly in the plain"; document.getElementById("demo").innerHTML = text.match(/ain/g); </script> </body> </html>