@SPArchaeologist Can you put something in a Fiddle? Then I can mess around with it a bit. I think you should look in a different group, at least if you put parentheses around .+
@ProgramFOX jsfiddle.net/L8x459ss/1 I am trying to understand how to select only the Foo Bar part. Seems that javascript reg ex engine works different than javascript one.
> If the match succeeds, the exec method returns an array and updates properties of the regular expression object. The returned array has the matched text as the first item, and then one item for each capturing parenthesis that matched containing the text that was captured.
@SPArchaeologist No, the first element is the part that it matches. And in the "test foo bar" case, it matches the whole string, and captures "foo bar" as a group. But if the regex would be only "foo bar", then the first element would be "foo bar", not "test foo bar".