const regex = /SDDFF/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('SDDFF', 'gm')
const str = `<Rows><Row><Attributes><Column><Name>ID</Name><Value>1111</Value></Column><Column><Name>Number</Name><Value>2222</Value></Column><Column><Name>Type</Name><Value>Solution Changed</Value></Column><Column><Name>Date</Name><Value>12/11/2020 8:01:22 AM</Value></Column><Column><Name>Operator</Name><Value>problem</Value></Column><Column><Name>Description</Name><Value>Solution changed from </Value></Column><Column><Name>VisibleToCustomer</Name><Value>N</Value></Column></Attributes></Row><Row><Attributes><Column><Name>ID</Name><Value>33333</Value></Column><Column><Name>Number</Name><Value>555</Value></Column><Column><Name>Type</Name><Value>Resolved Time Changed</Value></Column><Column><Name>Date</Name><Value>12/11/2020 8:01:22 AM</Value></Column><Column><Name>Operator</Name><Value>problem</Value></Column><Column><Name>Description</Name><Value>Resolved Time changed</Value></Column><Column><Name>VisibleToCustomer</Name><Value>N</Value></Column></Attributes></Row><Row><Attributes><Column><Name>ID</Name><Value>888888</Value></Column><Column><Name>Number</Name><Value>6677</Value></Column><Column><Name>Type</Name><Value>Updated By Changed</Value></Column><Column><Name>Date</Name><Value>12/11/2020 8:01:22 AM</Value></Column><Column><Name>Operator</Name><Value>problem</Value></Column><Column><Name>Description</Name><Value>Updated By changed from</Value></Column><Column><Name>VisibleToCustomer</Name><Value>N</Value></Column></Attributes></Row></Rows>`;
// 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