Javascript String getMatches(regex)
String.prototype.getMatches = function(regex) { var out = null; if (regex.test(this)) out = regex.exec(this);//from w ww . j ava2 s.c om return(out); };