const regex = /XX\.[A-Za-z]*\("(.*)",\s*([0-9A-Za-z]{2})\)/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('XX\\.[A-Za-z]*\\("(.*)",\\s*([0-9A-Za-z]{2})\\)', 'gm')
const str = `[XX.Ux("gI\\ny", sl), Ar, XX.Rx("\\t|", pO), Jd, XX.kx("xW\\n", CM), Wm, XX.wx("U\\vyV", DO), jr, XX.Mx("U\\vxW", GO), Zm, XX.tx("a{O", xO), Hm, XX.RV(Qk, Hl, Q0), Qd, XX.Nx("\\t|", OM), Br, XX.zx("{I\\v", vM), jd, XX.gx("U\\vxS", W6), nm, XX.kV(Qk, UM, Q0), Bd, XX.rx("\\t|", RM), Xm, XX.mx("V\\r", kM), Id, XX.dx("J\\t~", KY), Lm, XX.hx("xV\\v", wN), Sd, XX.bx("xU\\x00", d6), rd, XX.Cx("axK", BM), Wd, XX.qx("}~", h6), Zd, XX.sx("gI\\b", b6), Hd, XX.Kx("xU", C6), Lh, XX.Wx("U\\ry", q6), pm["fpValStr"], XX.wV(Qk, Ml, F0), vd, XX.Zx("sH", LN), jm, XX.Hx("{I\\f", jM), Xh], Vh && (Wr.push(XX.nx("xT", XN), XX.Ax("", VN)), Th = j3(N3)), Wr.push(XX.Fx("J\\nu", nY), Md), Kr = ph(j2, [Wr, A0]), Dh = Wr.join(Kr), qr(XX.Ex("9I\\x00", TN).concat(Dh["slice"](N3, W0)));
`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 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}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions