/

HTML / CSS / JavaScript Tutorial

JavaScript String method: match()

[this page | pdf | back links]

The match() method (when applied to a JavaScript string) searches the string for regular expression matches, and returns them as an array. If the regular expression does not include a g modifier (corresponding to a global search), match only returns the first match. If no match is found then the method returns null.

 

It has the following syntax with the following parameters:

 

string.match(regexpression)

 

Parameter

Required / Optional

Description

regexpression

Required

Regular expression being matched

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript String Variables


Desktop view | Switch to Mobile