Am I doing something wrong, or is it Google Chromes fault ?
Using non-capture and capture groups has the same effect as without them.
RegExr shows the first expected result. http://regexr.com?30mjo
var text = 'startdate: 123456, enddate: 789012';
var unix = text.match(/(?:start|end)date: (\d+)/g);
console.log(unix);
Actual result
["startdate: 123456", "enddate: 789012"]
Expected result
["123456", "789012"] or
["startdate: 123456", "123456", "enddate: 789012", "789012"]
Looks like the spec says that it should work this way.
Relevant line is
4. Let matchStr be the result of calling the [[Get]] internal method of result withargument "0"
on page 146 of the ecmascript spec where
resultis the array you get back from callingexec.I’ve been unable to find a way to make this work, other than manually calling exec and collecting the results like so: