Javascript examples for RegExp:RegExp Match
Avoid "null" with match()
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w .ja v a 2 s . c o m function checkMediaQueries(cssText) { return cssText.match(/@media/gi) ? true : false; } console.log( checkMediaQueries('nonsense') ); console.log( checkMediaQueries('@media all and more') ); } </script> </head> <body> </body> </html>