I found that the rollover 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.”, is obviously false. After all there are several last names (like “Nixon” and “Bush”) that denote both elected presidents and opponents. So no regular expression could both match and not match “Nixon”.

So that got me thinking: if we ignore names that are both winners and losers, what regular expression does cover the winners and not the losers? And let’s try to find a short one, although perhaps not the very shortest.

» nbviewer.ipython.org

Entradas relacionadas