RegExp.test() : RegExp Object : Regular Expressions JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Regular Expressions » RegExp Object »

 

RegExp.test()








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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Regular Expressions
» RegExp Object