Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I did some experimenting and is making the answer a community wiki, hoping that people will populate it. I tried to crack the simplest regexps and didn't dare to deal with "the bomb".</p> <h2>1. "adfsfloglig"=~ /.*(?{print "hi"})f/;</h2> <p>Here is the debug info for the regexp:</p> <pre><code>Final program: 1: STAR (3) 2: REG_ANY (0) 3: EVAL (5) 5: EXACT &lt;f&gt; (7) 7: END (0) </code></pre> <p>And the trace of execution with my comments:</p> <pre><code>#matches the whole string with .* 0 &lt;&gt; &lt;adfsflogli&gt; | 1:STAR(3) REG_ANY can match 11 times out of 2147483647... #splits the string to &lt;adfs&gt; and &lt;floglig&gt; and prints "hi". #Why does it split? Not sure, probably, knows about the f after "hi" code 4 &lt;adfs&gt; &lt;floglig&gt; | 3: EVAL(5) #tries to find f in 'floglig' - success 4 &lt;adfs&gt; &lt;floglig&gt; | 5: EXACT &lt;f&gt;(7) #end 5 &lt;adfsf&gt; &lt;loglig&gt; | 7: END(0) </code></pre> <h2>2. "adfsfloglig" =~ /.*(?{print "hi"})log/;</h2> <pre><code> 1: STAR (3) 2: REG_ANY (0) 3: EVAL (5) 5: EXACT &lt;log&gt; (7) 7: END (0) </code></pre> <p>Trace:</p> <pre><code>#matches the whole string with .* 0 &lt;&gt; &lt;adfsflogli&gt; | 1:STAR(3) REG_ANY can match 11 times out of 2147483647... #splits the string to &lt;adfsflog&gt; and &lt;lig&gt; and prints "hi". #Probably, it found 'l' symbol after the code block #and, being greedy, tries to capture up to the last 'l' 8 &lt;adfsflog&gt; &lt;lig&gt; | 3: EVAL(5) #compares the 'lig' with 'log' - failed 8 &lt;adfsflog&gt; &lt;lig&gt; | 5: EXACT &lt;log&gt;(7) failed... #moves backwards, taking the previous 'l' #prints 2-nd 'hi' 5 &lt;adfsf&gt; &lt;loglig&gt; | 3: EVAL(5) #compares 'loglig' with 'log' - success 5 &lt;adfsf&gt; &lt;loglig&gt; | 5: EXACT &lt;log&gt;(7) #end 8 &lt;adfsflog&gt; &lt;lig&gt; | 7: END(0) </code></pre> <h2>3. "adfsfloglig"=~ /.*(?{print "hi"})sflog/;</h2> <pre><code> 1: STAR (3) 2: REG_ANY (0) 3: EVAL (5) 5: EXACT &lt;sflog&gt; (8) 8: END (0) </code></pre> <p>Trace:</p> <pre><code>#matches the whole string with .* 0 &lt;&gt; &lt;adfsflogli&gt; | 1:STAR(3) REG_ANY can match 11 times out of 2147483647... #splits the string to &lt;adf&gt; and &lt;sfloglig&gt; and prints "hi". 3 &lt;adf&gt; &lt;sfloglig&gt; | 3: EVAL(5) #compares 'sfloglig' with 'sflog' - success 3 &lt;adf&gt; &lt;sfloglig&gt; | 5: EXACT &lt;sflog&gt;(8) #end 8 &lt;adfsflog&gt; &lt;lig&gt; | 8: END(0) </code></pre>
 

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