TIL: you can check if a number is prime using the regular expressions (ish)

/^1?$|^(11+?)\1+$/

In practise /^(11+?)\1+$/ finds all strings of some series of 1s followed by some number of repeats of that initial series of 1s. X(X+)

And /^1?$/ is a edge case check for one.

https://www.noulakaz.net/2007/03/18/a-regular-expression-to-check-for-prime-numbers/

A regular expression to check for prime numbers

@Cjen1 this is genius
@tambourineman @Cjen1 "I know, I'll use regex to solve a number problem", well know you have three problems