JavaScript match() Method
JavaScript String Object
Definition and Usage
The match() method returns the matches when matching a string against a
regular expression.
This method returns an array of information, or null if no match is found.
Syntax
| stringObject.match(regexp) |
Example
Example
Perform a global, case-insensitive search for "ain":
<script type="text/javascript">
var str="The rain in SPAIN stays mainly in the plain";
var patt1=/ain/gi;
document.write(str.match(patt1));
</script>
|
The output of the code above will be:
Try it yourself »
|
JavaScript String Object
Click here to design a Stunning Flash Website for Free
Wix is a revolutionary web design tool that provides anyone with the possibility to create professional and beautiful websites for free.
With e-commerce features, search engine visibility and many more professional tools, Wix is the ultimate solution for creating a spectacular site while saving tons of money.
|