Javascript examples for RegExp:RegExp Match
Regex matching over its boundaries
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// w w w .j a v a 2s . c om var testStr= "<bla bla ><body class='a b c d'><fo bar>"; var reg = /<body[^>]*>/i; var match = reg.exec(testStr); if(match != null){ // we know regex matched console.log(match[0].toString() + '\n'); } } </script> </head> <body> </body> </html>