Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does this regular expression kill the Java regex engine?
    primarykey
    data
    text
    <p>I have this naive regex "&lt;([\s]|[^&lt;])+?>" (excluding the quotation marks). It seems so straightforward but it is indeed evil when it works against the below HTML text. It sends the Java regular expression engine to an infinite loop. </p> <p>I have another regex ("&lt;.+?>"), which does somewhat the same thing, but it doesn't kill anything. Do you know why this happens?</p> <pre><code>&lt;script language="JavaScript" type="text/javascript"&gt; var numDivs, layerName; layerName = "lnavLayer"; catLinkName = "category"; numDivs = 2; function toggleLayer(layerID){ if (!(navigator.appName == "Netscape" &amp;&amp; navigator.appVersion.substr(0, 1) &lt; 5)){ thisLayer = document.getElementById(layerName + layerID); categoryLink = document.getElementById(catLinkName + layerID); closeThem(); if (thisLayer.className == 'subnavDefault'){ thisLayer.className = 'subnavToggled'; categoryLink.className = 'leftnavLinkSelectedSection'; } } } function closeThem(){ for(x = 0; x &lt; numDivs; x++){ theLayer = document.getElementById(layerName + (x + 1)); thecategoryLink = document.getElementById(catLinkName + (x + 1)); theLayer.className = 'subnavDefault'; thecategoryLink.className = 'leftnavLink'; } } var flag = 0; var lastClicked = 0 //--&gt; &lt;/script&gt; </code></pre> <p>it even keeps looping with an online Java regex tool (such as <a href="http://www.fileformat.info/tool/regex.htm" rel="noreferrer">www.fileformat.info/tool/regex.htm</a>) or a utility like <a href="http://www.regexbuddy.com/" rel="noreferrer">RegexBuddy</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload