const regex = /"\w+\|/g;
const str = `mmSuggestDeliver(0, new Array("Name", "Category", "Keywords", "Bias", "Extension", "IDs"), new Array(new Array("Advance Auto Parts Inc.", "Aktien", "982516|US00751Y1064|AAP||", "85", "", "Advance_Auto_Parts|982516|1|13715"),new Array("iShares China Large Cap UCITS ETF", "Anzeige", "", "100", "", "http://suggest-suche-A0DK6Z")), 2, 0);`;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
1
solved RegEx help in JavaScript – extract second match [duplicate]