Hacker News new | ask | show | jobs
by x-complexity 1015 days ago
I used 2 similar divide-by-3 regexes to test the page (after removing the ^ and $ to their ends), and it froze up:

Regex 1: ([0369]|([258]|[147][0369]*[147])([0369]|([147][0369]*[258]|[258][0369]*[147]))*([147]|[258][0369]*[258])|([147]|[258][0369]*[258])([0369]|([147][0369]*[258]|[258][0369]*[147]))*([258]|[147][0369]*[147]))*

Regex 2: ([0369]|[258][0369]*[147]|(([147]|[258][0369]*[258])([0369]|[147][0369]*[258])*([258]|[147][0369]*[147])))*

Everything up until the last '*' is parsable. The moment I put in the *, the entire page freezes up.

Without the *, it produced a valid verifier for parsing chunks of digits whose sum mod 3 = 0.