So, you think you know Regex-fu?
As I’ve mentioned:
/^1?$|^(11+?)\1+$/
Is a regular expression that matches a
non-prime number of ones (which means it can be used to recognize a prime number of ones, obviously). It’s obfuscated and golf-like at the same time. But here’s a challenge that takes Regular Expressions to the next level (possible the next lower level of Hell, but these are the risks we adventurers must face):
If you can provide a regular expression such that it actually matches the string representation of only prime (or only non-prime) integers, that would be pretty sweet. A proof that such a thing could not be created would be equally impressive.
Yes, it would be sweet indeed. Anyone up for the challenge? How hot is your Regex-fu?