A regular expression to check for prime numbers (2007)
I'll be "that guy" -- this is not a regular expression [1].  A Perl regexp, sure.  But backreferences are not part of the grammar of regular expressions, and moreover, using them in that particular manner (to refer to a capture of unbounded length) cannot be encoded as a DFA and therefore does not describe a regular language.(I have no clue whether unary-representation primality is actually regular or not -- it's been far too long since my automata class to remember how to (dis)prove that -- but I guess it's at least sublinear, since primality is polynomial w/r/t the logarithm of the number being tested.)[1] https://en.wikipedia.org/wiki/Regular_expression#Formal_defi...