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 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.
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
Samuel Arbesman is an applied mathematician and network scientist. He is a senior scholar at the Ewing Marion Kauffman Foundation and author of the book The Half-Life of Facts. His research and essays explore how to quantify all aspects of society.
Follow @arbesman on Twitter.