I know this topic has been thoroughly covered on StackOverflow, but I can\'t for the life of me get my regular expression to work. So without further repetitive ado ...
A non-capturing group is basically just a non-group ― a way to use parentheses without actually treating that part of the pattern as a group.
It looks like what you're actually looking for are the "match prefix but exclude" group (?<=)
and the "match suffix but exclude" group (?=)
.
Note: This type of group does not seem to be supported in Internet Explorer.
If you use these, you get the desired result:
var str = "";
var regex = /(?<=model=')[^']*(?=')/g
var matches = str.match(regex);
console.log(matches);