const regex = /<center>(.|\n)*<\/center>/;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('<center>(.|\\n)*<\\\/center>', '')
const str = `</head>
<body style="background-color:#9b9b9b;">
**<center>
<table width="580" border="0" cellspacing="0" cellpadding="0" align="center" class ="responsive-table" style="background-color:#3e5b3e;border:solid thin #3e5b3e;" >
<tbody>
<tr>
<td background="http://app.randomsite.com/js/ckfinder/userfiles//images/banner.jpg" style="padding-top:20px;padding-right:20px;padding-left:20px;" class="hideForMobile"><h1 style="font-family:Arial, Helvetica, sans-serif;font-size:20px;font-weight:bold;text-align:right;color:#eee;vertical-align:bottom;text-decoration:none;margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;" >some message</h1></td>
</tr>
<tr>
</center>**
<!---Start of Banner Image--->
<td><a href="{{Custom1}}" style="color:inherit;text-decoration:none;" ><img src="http://app.clientcommand.com/js/ckfinder/userfiles//images/top-dollar-ford-banner.jpg" alt="" class="table.responsiveImage" style="display:block;width:100%;border-style:none;" /></a></td>
<!---End of Banner Image--->
</tr>
<tr>`;
// 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