Is there any way to specify which group I want stored without the use of Pattern or Matcher? The following code matches the "hello", I'd like to match the "hi" in the second group.
var matches = [];
var test = "#hello# #hello#hi# #hello# #hi#";
test.replace(/#(hello)#(hi)#/gi, function (string, match) {
matches.push(match);
});
alert(matches);
Pretty sure I need a $2 or a .group(1) somewhere.
edit: function(match, $1, $2) did it.