JavaScript Program to Check Regular Expression using test() method

Write a JavaScript program to check regular expression using test() method.



Source Code
<html>
<head>
    <title>Regular Expression using test() method</title>
    <script>
        function checkRE()
        {
            var text = document.getElementById('input').value
            var regex = /abc/
            var res = regex.test(text)
            document.getElementById('panel').innerHTML = res
        }
    </script>
</head>
<body>
Enter text <input type="text" id="input"/>
<input type="button" value="Check" onclick="checkRE()"/>
<p id="panel"></p>
</body>
</html>
Output