<html> <body> <script type="text/javascript"> var patt1=new RegExp("e","g"); do { result=patt1.exec("The best things in life are free"); document.write(result); } while (result!=null) </script> </body> </html>
Your Result:
Edit the code above and click to see the result.
W3Schools.com
- Try it yourself