 <p>Basically, your regular expression is recursive. Removing the final <code>.+</code> solves the issue. Here is <a href="http://www.regular-expressions.info/catastrophic.html" rel="nofollow">a good article</a> on avoiding it in the future. Why does .NET hang? Probably because it will never abort the search. Perhaps the JavaScript parser you used aborts if it detects too many steps or goes too deep into recursive searches.</p>