const regex = /(\d{6}\_\d{9})\=.*(gurlan,danu)/gmi;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(\\d{6}\\_\\d{9})\\=.*(gurlan,danu)', 'gmi')
const str = `[7384] [Birthdays]
[7384] 180528_201747263=198202141300
[7384] 180528_210749326=19840222
[7384] 180528_211723352=19831207
[7384] 180528_211845500=201607072350
[7384] 180528_212024116=19591231
[7384] 180528_212038465=19590323
[7384] 180528_213357273=19590811
[7384] 180528_213701342=19780608
[7384]
[7384] [NameSurname]
[7384] 180528_201747263=Gurlan V. Vasile aka. Licuta
[7384] 180528_210749326=Gurlan (Enea) V. Maria aka Mariana
[7384] 180528_211723352=Danu (Gurlan) F. Oana Nicoleta aka. Nikol
[7384] 180528_211845500=Gurlan V. Rebecca-Ioana
[7384] 180528_212024116=Gurlan P. Vasile
[7384] 180528_212038465=Nucu (Gurlan) N. Maria
[7384] 180528_213357273=Bogdan (Danu) G. Elena
[7384] 180528_213701342=Enea D. Ioan Dorin
`;
// 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