O resultado da execução desse script é:
![imagem-003.jpg](https://s3.amazonaws.com/qcon-assets-production/images/provas/37275/imagem-003.jpg)
The match() method searches a string for a match against a regular expression, and returns the matches, as an Array object.
Note: If the regular expression does not include the g modifier (to perform a global search), the match() method will return only the first match in the string.
This method returns null if no match is found.
Perform a global, case-insensitive search for "ain":
var str = "The rain in SPAIN stays mainly in the plain";
var res = str.match(/ain/gi);
The result of res will be:
ain,AIN,ain,ain
http://www.w3schools.com/jsref/jsref_match.asp