Regular Expressions 101

Prime numbers test

Open Workspace
  • Python
  • Match
2

Regular Expression

r"
^1?$|^(11+?)\1+$
"

Description

Given a number N represented by its unary form N(1), when RegEx doesn't match N(1), N is prime

Submitted by LexDias