The test() method tests for a pattern match in a string.
Returns Boolean value true or false.
<html>
<body>
<script language="JavaScript">
<!--
myExp = new RegExp("is", "g");
str = "This is a test";
if(myExp.test(str)){
document.write("The test found \"hope\" in the string: " + "<b>" + " I hope everything is going well" + "</b>");
}
-->
</script>
</body>
</html>