Write a JavaScript program to check whether given string contains a word or not using regular expression.
<html>
<head>
<title>Regular expression to find given word</title>
<script>
function check()
{
var txt=document.getElementById('txt').value
var re = /\bJavaScript\b/
var res=re.test(txt)
if(res)
alert('Word found')
else
alert('Word not found')
}
</script>
</head>
<body>
Enter text <input type="text" id="txt"/>
<input type="button" value="Submit" onclick="check()"/>
</body>
</html>
