<html>
<body>
<p>Click the button to return the text of the RegExp pattern.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var str = "Visit W3Schools";
var patt1 = /W3S/g;
var res = "The text of the RegExp is: " + patt1.source;
document.getElementById("demo").innerHTML = res;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_regexp_source by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 05 Jun 2019 14:02:37 GMT -->
</html>