The Regular Expressions of Chanukah

Many of you have likely stumbled upon regular expressions. Those oddly formulated text strings that specify a general shape to the text that you’re looking for. For example, want to find any time two digits are next to each other? Then simply use [0-9][0-9]. Or, want to find any word that begins with at least […]

Many of you have likely stumbled upon regular expressions. Those oddly formulated text strings that specify a general shape to the text that you're looking for. For example, want to find any time two digits are next to each other? Then simply use [0-9][0-9]. Or, want to find any word that begins with at least one 'a' and ends in 'vark'? Use the regular expression \ba+.+vark\b

Regular expressions consist of a simple language and are used by programmers and others who analyze large texts and datasets. And they are actually rudimentary computers. Regular expressions are the embodiment of certain types of abstract machines known as finite automata, simple computational engines that can match patterns. They can't do complicated calculations or run Microsoft Word, but they are one simple step on the path to Turing completeness.

And regular expressions can also be used to deal with the word 'Chanukah.' Or maybe it's 'Hanukkah'? You see where I'm going with this. There are so many ways to spell this holiday, we shouldn't be using lots of alternate spellings; we should be using regular expressions.

Happily, others have already noticed this issue and found a solution. Behold, a regular expression for the holiday: [CHK]h?ann?[aeiu]kk?ah?

For those celebrating this weekend, Happy Chanukah!

Bonus: regular expressions can also be used for the many spellings of Ghaddafi: \b(Kh?|Gh?|Qu?)[aeu](d['dt]?|t|zz|dhd)h?aff?[iy]\b

Top image:Terry Babij/Flickr/CC