JavaScript Program to Demonstrate Use of match() method

Write a JavaScript program to demonstrate use of match() method.



Source Code
<html>
<head>
    <title>Regular expression use of match() method</title>
</head>
<body>
    <script language="JavaScript">
        re = /\w+\s/g;
        str = "fee fi fo fum";
        myArray = str.match(re);
        document.write(myArray);
    </script>
</body>
</html>
Output





"Coding Hub - Learn to code" app now available on Google Play Store