regular expression for primes
A regular expression for testing primes? Does this really work? At first look, it’s super ugly but then the beauty of it starts to seep out once one realizes that it really works!
And the magic formula is…
/^1?$|^(11+?)\1+$/