I found that the hover text, “/bu|[rn]t|[coy]e|[mtg]a|j|iso|n[hl]|[ae]d|lev|sh|[lnd]i|[po]o|ls/ matches the last names of elected US presidents but not their opponents.“, contains a confusing contradiction. There are several last names (like “Nixon”) that denote both elected presidents and opponents. So no regular expression could both match and not match “Nixon”. I could only assume that Randall meant for these names to be winners and not losers (and in fact he later confirmed that was the correct interpretation).
So that got me thinking: can I come up with an algorithm to find a short regex that covers the winners and not the losers?
I started by finding a page that lists winners and losers of US presidential elections through 2000. Adding the 2004-2012 results I get: …
Apparently there is a Regex Golf game.
Type a regex in the box. You get ten points per correct match. Hit Enter to go to the next ‘level’.