Get the result on regex test() method - Javascript RegExp

Javascript examples for RegExp:RegExp test

Description

Get the result on regex test() method

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {/*from  ww  w  . j  ava 2  s  .c o  m*/
var string = "joe@aol.com";
var pattern = /[\w-]+@([\w-]+\.)+[\w-]+/i;
var match = pattern.test(string);
document.write(match);
    });

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials