const regex = /(?<=m)(2|3)/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(?<=m)(2|3)', 'g')
const str = `superscript
(?<=m)(2|3)
®|™
(?<=\\d)(de|ème)
REF
\\d{6}/(D|T|X)
REF2
\\d{3}/(D|T|X)
REF3
\\d{6}(?-)
VET
garantie[^\\r\\n]+jaar
Fraction
\\b1/2\\b
PARQUET STRATIFIE ‘MEGALOFT’
Différents motifs
Longueur 1286mm x largeur
194mm
10000kcal/u
25mm2
10dm3 10dm3/u
1000m3/u
850l/u
1000m3/h
850l/h
1,99m2/pak
1,33m3
1,25m2
25kg
700559/D
1,59m3/pak
1,996m2/paquet
700496-123566-123/D
1,996m2/paquet
123566-123/D
1,99m2 en 199m3/h
135234-123/D
Gerst 004729/D
Schors 058157/D
Ø 30/60 x H230cm
Polyester doek 280gr/m2
Crossover®-ontstekingssysteem
™ Toelatingsnr: 3001B
32/38mm slang
ZANDFILTERKIT 10m3/u
Debiet 1,2m2/u
Zinklaag: 180-250gr/m2
2de handgreep
2ème poignon
Garantie 25 jaar
10 jaar waarborg
Maaihoogteregeling 20-75mm
Gerst 004729/D
Schors 058157/D
Ø 30/60 x H230cm
Polyester doek 280gr/m2
Crossover®-ontstekingssysteem
™ Toelatingsnr: 3001B
32/38mm slang
ZANDFILTERKIT 10m3/u
Debiet 1,2m2/u
Zinklaag: 180-250gr/m2
2de handgreep
2ème poignon
garantie 25 jaar
garantie 25 jaar
Garantie 25 ans jar
Jaar Garantie 25
25 jaar garantie
10 jaar waarborg
Maaihoogteregeling 20-75mm
1/2
®
541358/9/60
541358-12-12/D
541358-123-123/D
541358-1234-1234/D
541358-12345-12345/D
541358-123456-123456/D`;
// 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