const regex = /^(Name=")(Show_Type"|Licensing_Window_End"|Display_As_New")(\s+Value="[A-Za-z0-9-:\s]+")([\/>\s]+)(.*)$/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^(Name=")(Show_Type"|Licensing_Window_End"|Display_As_New")(\\s+Value="[A-Za-z0-9-:\\s]+")([\\\/>\\s]+)(.*)$', 'gm')
const str = `App_Data App="MOD" Name="Genre" Value="Series"/><App_Data App="MOD"
Name="Show_Type" Value="Series"/><App_Data App="MOD" Name="Billing_ID"
Value="10092"/><App_Data App="MOD" Name="Licensing_Window_Start"
Value="2019-05-07 00:00:00"/><App_Data App="MOD"
Name="Licensing_Window_End" Value="2019-05-13 23:59:59"/><App_Data
App="MOD" Name="Preview_Period" Value="0"/><App_Data App="MOD"
Name="Display_As_New" Value="4"/><App_Data App="MOD"
Name="Display_As_Last_Chance" Value="7"/><App_Data App="MOD"
Name="Provider_QA_Contact" Value="NBC Universal"/><App_Data App="MOD"
Name="Suggested_Price" Value="0.00"/><App_Data App="MOD" `;
// 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