match() in Javascript
match() in Javascript
<!DOCTYPE html>
<html>
<head>
<title>Test page</title>
<script type="text/javascript">
//match will search for the given item and return them in the form of an array it returns null if it doesn't find the searched item
var str= "HELLO TO WORLD WELCOME TO THE NEW GENERATION!!Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eveniet, saepe.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Molestiae, dolorem.";
var b= str.match(/TO/g);
var c= str.match(/hello/g);
console.log(b);
document.write(c);
</script>
</head>
<body>
<h1></h1>
</body>
</html>
<html>
<head>
<title>Test page</title>
<script type="text/javascript">
//match will search for the given item and return them in the form of an array it returns null if it doesn't find the searched item
var str= "HELLO TO WORLD WELCOME TO THE NEW GENERATION!!Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eveniet, saepe.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Molestiae, dolorem.";
var b= str.match(/TO/g);
var c= str.match(/hello/g);
console.log(b);
document.write(c);
</script>
</head>
<body>
<h1></h1>
</body>
</html>
Comments
Post a Comment
I WOULD APPRECIATE IF YOU LEAVE A COMMENT OR YOUR FEEDBACK HERE !!!