Categories
Javascript

How to find same word in paragraph through JavaScript

How to find same word in paragraph through JavaScript

In this tutorial we will learn How to find same word in paragraph through JavaScript. When you search in a paragraph, you can use a pattern to describe what you are searching for.Some time it is very useful.

Here a simple script to help you through JavaScript:

<html>
<body><script type="text/javascript">
var str="and  this all and there is and is?";
var str1=/and/g;
document.write(str.match(str1));</script></body>
</html>

I think you will be find this tutorial usefull, THANKS.