const regex = /^<row Id="([^"]*)" PostTypeId="([^"]*)" ParentId="([^"]*)" CreationDate="([^"]*)" Score="([^"]*)" Body="([^"]*)" OwnerUserId="([^"]*)" LastEditorUserId="([^"]*)" LastEditorDisplayName="([^"]*)" LastEditDate="([^"]*)" LastActivityDate="([^"]*)" CommentCount="([^"]*)"?.*$>/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('^<row Id="([^"]*)" PostTypeId="([^"]*)" ParentId="([^"]*)" CreationDate="([^"]*)" Score="([^"]*)" Body="([^"]*)" OwnerUserId="([^"]*)" LastEditorUserId="([^"]*)" LastEditorDisplayName="([^"]*)" LastEditDate="([^"]*)" LastActivityDate="([^"]*)" CommentCount="([^"]*)"?.*$>', 'g')
const str = `<row Id="1394" PostTypeId="2" ParentId="1390" CreationDate="2008-08-04T16:38:03.667" Score="16" Body="<p>Not sure how credible <a href="http://www.builderau.com.au/program/windows/soa/Getting-started-with-Windows-Server-2008-Core-edition/0,339024644,339288700,00.htm" rel="nofollow noreferrer">this source is</a>, but:</p>

<blockquote>
 <p>The Windows Server 2008 Core edition can:</p>
 
 <ul>
 <li><p>Run the file server role.</p></li>
 <li><p>Run the Hyper-V virtualization server role.</p></li>
 <li><p>Run the Directory Services role.</p></li>
 <li><p>Run the DHCP server role.</p></li>
 <li><p>Run the IIS Web server role.</p></li>
 <li><p>Run the DNS server role.</p></li>
 <li><p>Run Active Directory Lightweight Directory Services.</p></li>
 <li><p>Run the print server role.</p></li>
 </ul>
 
 <p>The Windows Server 2008 Core edition cannot:</p>
 
 <ul>
 <li><p>Run a SQL Server.</p></li>
 <li><p>Run an Exchange Server.</p></li>
 <li><p>Run Internet Explorer.</p></li>
 <li><p>Run Windows Explorer.</p></li>
 <li><p>Host a remote desktop session.</p></li>
 <li><p>Run MMC snap-in consoles locally.</p></li>
 </ul>
</blockquote>
" OwnerUserId="91" LastEditorUserId="1" LastEditorDisplayName="Jeff Atwood" LastEditDate="2008-08-27T13:02:50.273" LastActivityDate="2008-08-27T13:02:50.273" CommentCount="1" /> `;
// 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