Differece between javascript's regexp functions JavaScript 09.12.2013

Short note about differece between test(), match(), exec() and search().

Funtion Returns Example Output
test() true/false /(\d+)/.test('221B Baker Street') true
match() returns an array with the matches or null if there are none '221B Baker Street'.match(/(\d+)/) ["221", "221"]
exec() returns the matching pattern as array /\d+/.exec('221B Baker Street') ["221"]
search() returns the matching pattern's index '221B Baker Street'.search(/\d+/) 0
split() returns array with chunks '221B Baker Street'.split(/\s/g) ["221B", "Baker", "Street"]