JSFiddle - React, Tailwind, and code Playground

HTML

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

JavaScript

window.myFunction = function() {
    var str = "The rain in SPAIN stays mainly in the plain"; 
    var res = str.match(/ain/i);
    document.getElementById("demo").innerHTML = res;

}