Detecting prime numbers with regex

from blog J. Carlos Roldán, | ↗ original
The suggestions coming from Github Copilot look sometimes like alien technology, particularly when some incomprehensible code actually works. Recently, I stumbled upon this little excerpt that tests if a number is prime (and it actually works): !/^1?$|^(11+?)\1+$/.test('1'.repeat(n))"> The ways of the universe are mysterious Let's dissect the...