RegEx Golf

RegEx Golf
Inspired by the famous XKCD cartoon that started it and by Google’s Peter Norvig over on O’Reilly.com I decided to play some RegEx Golf myself this Easter…

If you’re not familiar with the game – the idea is to write the shortest regular expression possible that will select every element of a list, without selecting any elements from a second list. But what are regular expressions, you ask? Well, they’re a special sequence of characters that specify a particular textual patter – so you can use the appropriate regular expression when programming to automatically extract specific text from a list, file, or other text. There are some great tutorials on the web if you want to learn regular expressions (and you really should – because they’re great) – for example regexone.com

I didn’t want to use lists of Presidents of the United States (as that had been done) – so I decided to have a go at the age-old challenge: animal, mineral, or vegetable

Continue reading “RegEx Golf”