const regex = new RegExp('<Row.+?>((?:\\n.*?)*)<\\/Row>', 'g')
const str = `<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s69"><Data ss:Type="String">LcolDefs:</Data></Cell>
<Cell ss:StyleID="s69"><Data ss:Type="String">Lkeywords:</Data></Cell>
<Cell ss:StyleID="s69"><Data ss:Type="String">TestProcedure</Data></Cell>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s71"><Data ss:Type="String">LsetupTest:NMTA-1772</Data></Cell>
<Cell ss:StyleID="s72"><Data ss:Type="String">DROP4</Data></Cell>
<Cell ss:StyleID="s71"><Data ss:Type="String">TEX::stepCatch log::log notice "start NMTA-1772"</Data></Cell>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s73"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
</Row>
<Row ss:AutoFitHeight="0" ss:StyleID="s74">
<Cell ss:StyleID="s69"><Data ss:Type="String">LcolDefs:</Data></Cell>
<Cell ss:StyleID="s69"><Data ss:Type="String">Lkeywords:</Data></Cell>
<Cell ss:StyleID="s69"><Data ss:Type="String">TestProcedure</Data></Cell>
<Cell ss:StyleID="s75"><Data ss:Type="String">Ljoin:Host</Data></Cell>
<Cell ss:StyleID="s75"><Data ss:Type="String">Ljoin:Port</Data></Cell>
<Cell ss:StyleID="s76"><Data ss:Type="String">Lparam:typeGroup</Data></Cell>
<Cell ss:StyleID="s76"><Data ss:Type="String">Lparam:ipAddress</Data></Cell>
<Cell ss:StyleID="s76"><Data ss:Type="String">Lparam:connectionType</Data></Cell>
<Cell ss:StyleID="s76"><Data ss:Type="String">Lparam:port</Data></Cell>
<Cell ss:StyleID="s76"><Data ss:Type="String">Lparam:username</Data></Cell>
<Cell ss:StyleID="s76"><Data ss:Type="String">Lparam:password</Data></Cell>
<Cell ss:StyleID="s76"><Data ss:Type="String">Lparam:id</Data></Cell>
<Cell ss:StyleID="s77"><Data ss:Type="String">Lparam:-code</Data></Cell>
<Cell ss:StyleID="s77"><Data ss:Type="String">Lparam:-pollGetNc</Data></Cell>
<Cell ss:StyleID="s77"><Data ss:Type="String">Lparam:-checkNe</Data></Cell>
<Cell ss:StyleID="s77"><Data ss:Type="String">Lparam:-checkDup</Data></Cell>
<Cell ss:StyleID="s77"><Data ss:Type="String">Lparam:-initializeVar</Data></Cell>
<Cell ss:StyleID="s77"><Data ss:Type="String">Lparam:-convertToJson</Data></Cell>
<Cell ss:StyleID="s70"/>
<Cell ss:StyleID="s70"/>
</Row>
`;
// 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