const regex = /^([A-Ga-g])(bb|b|#|x|)(.*?)(2|3|4|5|7|9|11|#11|13|15|#15)?((?:(?:(?:bb|b|#|x)?(?:10|1?[1-9]))|[Dd][Ii][Mm]|o|O|\u{1D698}|\u{25CB}|\u{1D3C}|\u{25E6}|\u{00B0}|[Hh][Dd][Ii][Mm]|0|\u{00D8}|\u{00F8}|\u{2205}|\u{2300}|\u{1D1A9}|[Ss][Uu][Ss]|[Aa][Uu][Gg]|\+|[Aa][Dd][Dd][b#]*1*[0-9]|[Nn][Oo][b#]*1*[0-9]|[Aa][Ll][Tt]|[()])*)$/u;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^([A-Ga-g])(bb|b|#|x|)(.*?)(2|3|4|5|7|9|11|#11|13|15|#15)?((?:(?:(?:bb|b|#|x)?(?:10|1?[1-9]))|[Dd][Ii][Mm]|o|O|\\u{1D698}|\\u{25CB}|\\u{1D3C}|\\u{25E6}|\\u{00B0}|[Hh][Dd][Ii][Mm]|0|\\u{00D8}|\\u{00F8}|\\u{2205}|\\u{2300}|\\u{1D1A9}|[Ss][Uu][Ss]|[Aa][Uu][Gg]|\\+|[Aa][Dd][Dd][b#]*1*[0-9]|[Nn][Oo][b#]*1*[0-9]|[Aa][Ll][Tt]|[()])*)$', 'u')
const str = ``;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
if ((m = regex.exec(str)) !== null) {
// 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