Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>GolfScript - 254 chars</strong></p> <pre><code>n%([]:B:$:_"()"@*{:I"()*+|?"[{}/]?[{[[0B$,+:B))\;)]_]+}{B)):ß;:B;qß(:ß;}{8q}{[[0ß0$,)]]+}:8{[[0B-1=:ß)]]+:$q}{ß&gt;$ß&lt;\([0+$,+]\++}:q{[[I$,:ß)]]+}]=~:$}/;{n+[0]:3\{:c;;3:1_:3;{,}{)[$=]_*2/{~\.{c={3|:3}*;}{;.1|1,\:1,&lt;{+0}*;}if}/}/;}/;1$,?)"true""false"if n}% </code></pre> <p>Somewhat straightforwardly, the first loop converts the regex into an NFA, which the second loop runs.</p> <p><code>Sun Aug 22 00:58:24 EST 2010</code> <strong>(271→266)</strong> changed variable names to remove spaces<br> <code>Sun Aug 22 01:07:11 EST 2010</code> <strong>(266→265)</strong> made <code>[]</code> a variable<br> <code>Sun Aug 22 07:05:50 EST 2010</code> <strong>(265→259)</strong> made null state transitions inline<br> <code>Sun Aug 22 07:19:21 EST 2010</code> <strong>(259→256)</strong> final state made implicit<br> <code>Mon Feb 7 19:24:19 EST 2011</code> <strong>(256→254)</strong> using <code>"()""str"*</code></p> <pre><code>$ echo "ab*a aa abba abab b"|tr " " "\n"|golfscript regex.gs true true false false $ echo "0*1|10 1 10 0110 00001"|tr " " "\n"|golfscript regex.gs true true false true $ echo "0*(1|1+0) 1 10 0110 00001"|tr " " "\n"|golfscript regex.gs true true true true $ echo "a?b+|(a+b|b+a?)+ abb babab aaa aabba a b"|tr " " "\n"|golfscript regex.gs true true false true false true $ echo "((A|B|C)+(a|(bbbbb)|bb|c)+)+ ABCABCaccabbbbbaACBbbb ABCABCaccabbbbbaACBbbbb"|tr " " "\n"|golfscript regex.gs false true </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