Use Regex to match message - Javascript RegExp

Javascript examples for RegExp:RegExp Match

Description

Use Regex to match message

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  w w  w.j av  a  2  s  .co m
var regex = new RegExp('(Message.*?TFTP service is down.|Message: device name is unreachable)');
console.log(regex.test('Message: \\SERVERNAME: TFTP service is down.'));
    }

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

Related Tutorials