I came across regular expressions at work. I am not alone in finding this tool difficult to master. So I decided to read up and put out and explanation. The first thing I did was deconstruct the term itself. What is meant by "regular" and "expression"? Simply put, the term can be rewritten as "common communication". A set of pieces of information. But we need a way to find patterns, to find the set of information pertinent to our needs. The symbolic notations of regex (eg %s/grey/gray/g) are used to find these patterns in text data. Regex is used by sysadmins and webdevs as a problem solving tool. The problem is that there is too much text data in computers and applications. In fact, since the day of moving media (radio and cinema) there is too much information for us to handle. But that is food for another blog entry.
There are three reason's to use regular expressions: a) navigation, b) manipulation and c) validation. With navigation one tells the cursor to goto a particular place in a file. With manipulation one can find-and-replace a string in a file. And validation is used to test if data inserted into an application (eg a web form) conforms to the defined input criteria. All are essential tasks in the ICT world. Sysadmins work on machines with a lot of files, containing a lot of text data. One can't read and remember all of the text data so one uses regex together with programmes like Less and Vim. For example to find a particular email address in a large log file, or to edit a configuration file. Similarly webdevs make and update websites. These contain a lot of markup and a lot of lines of code. To find and replace a string manually is inefficient use of time and one would be crazy not to use regex for the task.
Pattern finding is part of problem solving, and a lot of fun. There is a card game called SET which is playable by both kids and adults. It was created by Marsha Jean Falco in 1974 while working as a population geneticist, to help her find out whether a particular characteristic in German Sheperds was inherited. What we see in this game is a collection of well-defined objects. The regex algorithm relates only to text data. So a tool for pattern matching in visual data is the next step. I'm sure they exist, how else can software pick out specific faces given a pool of millions of images? However that too implies the use of text data (maths and code). Is a world without graphemes possible? To begin with, is it even imaginable?