const regex = /^[A-Za-z0-9+\/]{22}==$/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^[A-Za-z0-9+\\\/]{22}==$', 'gm')
const str = `/*Base64 encoded object GUID*/
z5mytpY3n0uS7WotFo0XPQ==
y1NiJQ4GvkOc6Sza75j61A==
LGRAKG1ns0u0i7HlruqP3Q==
QOrSNu771Eyc8xQ2pS1jFg==
X9wPxWuMukaZZyDBof7znw==
lQk7QUbexkGt8s6xEu0UoA==
lQk7QUbexkGt8s6xEu0UoA==
lQk7QUbexkGt8s6xEu0UoA==
FCE4wll/okm/2Hgp2cdmMg==
qAzTWmiXT0SHg2sh9h2r8g==
ksVRSMPQhEGrcm6giubf1w==
2BB+XUPh/0mdSrk7tcoi9g==
PtsmDdnwwkKMIOpifql3EQ==
10hez6mxQk+PGIwoNvIzWg==
sr9hU+51nUClfMW/rs6Sog==
zqVrydHA/UqX1OH+TZaaNg==
mL5TJlQ2U0euhNgPXRKcyA==
z5mytpY3n0uS7WotFo0XPQ==`;
// 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