<html>
<body>
<p>Click the button to perfom a global, case-insensitive search for the letters "ain" in a string, and display the matches.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var str = "The rain in SPAIN stays mainly in the plain";
var res = str.match(/ain/gi);
document.getElementById("demo").innerHTML = res;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_match_regexp2 by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 05 Jun 2019 14:03:05 GMT -->
</html>