regex goes Infinite loop for html attribute matching

<(?<nodeName>[a-zA-Z][-a-zA-Z0-9_]*)(?<attributes>(?:s*[a-zA-Z_:!0-9,][-a-zA-Z0-9_:%."'`;(]*(?:s*=s*(?:(?:"[^"]*")|(?:'[^']*')|{{[^>}]*}}|[^>]+|w*))?)*)s*(/?)>

This above regex trying to match the tagName and attributes.

<span class='Utils.showtt("{{getI18n('zr.ratings.reviews.client.review.tag', getCrmModuleInfo('Accounts', 'true'))}}")'>

but getting infinite loop since quotes mismatched in this input. Is there any way to throw error or prevent infinite loop.