Coding + Gold = Good Time. Today's problem is to create the smallest regex possible that will match the words in the Match column but not the words in the Unmatch column. In regex golf you only need to match a character (or a few sequential characters in some cases) in the word and not the entire word itself. For example if I wanted to match football but not banana then my regex could be the letter f.
Match | Unmatch |
---|---|
football | banana |
soccer | orange |
tennis | grapes |
basketball | pear |
poker | apricot |
If you love regex golf definitely check out http://regex.alf.nu/.
Comments:
Daniel - 10 years, 7 months ago
Short .NET one
Tested here
reply permalink
Daniel - 10 years, 7 months ago
One character shorter
reply permalink
James - 10 years, 7 months ago
((.)\2)|k
reply permalink
Nick Krichevsky - 10 years, 7 months ago
This one works according to pythex
.*ll?|.*cc.*|.*nn.*|.*er
reply permalink
Pearce Keesling - 10 years, 7 months ago
Sometimes regex just feels like witchcraft, but it's satisfying to get it working.
reply permalink
Anonymous - 10 years, 6 months ago
Shortest one I could find:
t.|er
reply permalink