const regex = new RegExp('^([a-zA-Z0-9-]{1,})>(.*?)[,](.*){1,},(qA[CXUoOSrRiZI]),(.+){1,}:', 'gm')
const str = `# aprsc 2.1.13-g79b6c3e
# logresp WV6L unverified, server FIRST
KG6DMY-9>APAT51,RCHFLD,WIDE1*,qAR,ABAJO:!3846.80N/11205.07W&261/000/A=005347I'm Charles. 146.640 - pl 100
N3FAA>APRS,TCPIP*,qAC,AMBCWOP-2:@062011z3447.10N/11816.47W_049/001g002t053r000p001P001h57b10216L412AmbientCWOP.com
KM6WSX>APX219,N6EX-4*,qAR,KELLER:=3405.98N/11736.25W-/A=001105/
K7EDT-S>APDG01,TCPIP*,qAC,K7EDT-GS:;K7EDT B *062011z3322.32ND11148.72WaRNG0001/A=000010 440 Voice 443.12500MHz +0.0000MHz
RUTH>APNX02,WIDE3-3,qAR,N7GWT:!3918.75NS11505.39W#PHG58306/W3,NVn,N7GWT, Kimberly Pk, Nv
KD6FEE>APFII0,qAC,APRSFI:@201141h3343.14N/11747.18W[178/000/A=000108Stormprobe | KD6FEE@arrl.net!w5X!
XE2BNC-1>APMI06,WIDE2-2,qAR,XE2SI-10:@070122z3218.82N/11639.92WnPHG59304/CREBC Cerro Bola
N4RDZ-9>S3SWXY,W7DXJ-12,WIDE1,W6SCE-11*,WIDE2,qAR,N2GTR-2:\`*)p{k>/\`"7/}_%
SQUAW>APN391,qAO,PVALY:!3428.16NS11152.56W#PHG3000/W3,AZn SQUAW PEAK DIGI 6479 FT W7EI
W7JLW>APRS,TCPIP*,qAC,T2CSNGRAD:@062013z3240.80N/11425.20W_049/003g007t062r000p000P000h44b10221eCumulusDsVP
K6CMG-7>APDR16,TCPIP*,qAC,T2FINLAND:=3404.28N/11728.09Wu359/002/A=000973 up to no good.
KC6JPG-D>APDG03,TCPIP*,qAC,KC6JPG-DS:!3407.92ND11733.37W&/A=000000440 MMDVM Voice 426.50000MHz +0.0000MHz, APRS for DMRGateway
KG5SWO>APRS,TCPIP*,qAC,AMBCWOP-2:@062011z3803.83N/12039.19W_151/000g000t054r000p000P000h60b10251L264AmbientCWOP.com
K0RNA-9>S3TVSQ,WIDE1-1,WIDE2-1,qAR,AG7GK-2:\`(0Vm-6k/\`"8p}Encore Floors -Blue F-150 - Rich-Love,Peace,& Chicken Grease_%
KG6DMY-9>APAT51,RCHFLD,BACON,WIDE1*,qAR,ABAJO:!3846.80N/11205.07W&261/000/A=005347I'm Charles. 146.640 - pl 100
`;
// 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