const regex = /(((([0-9])?[A-Z]{1,})(([A-Z0-9./+]+){0,}-){1,})[A-Z0-9./+]+\=*)/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(((([0-9])?[A-Z]{1,})(([A-Z0-9.\/+]+){0,}-){1,})[A-Z0-9.\/+]+\\=*)', 'g')
const str = `The ABC-CD40N= is also supported on GH-K slots on the 4000 Series ISRs using the XYZ-X-THM . This SM-X-NIM-REW34= information is not captured in the table above terms with only digits shoud not match --> 1-800-553-6387 hdhdhh IP-IP
YUIO-10GB-BG4: Supports JK-X6824-UIO-XK++= U-VI1.1-100-WX-Y9
VA-V
XX-123-UVW-3456
VA-V-W-K9
VA-V-W
800-CVB-4=
CD-EF-GH-40G-R9(=)
`;
// 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