O resultado da execução desse script é:
Comentários
Veja os comentários dos nossos alunos
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
Clique para visualizar este comentário
Visualize os comentários desta questão clicando no botão abaixo