Getting a handle on the Khadaffi / Ghadafy / Qaddaffi problem

To eliminate or at least reduce the confusion caused by the multiple spellings of the name of the embattled leader of Libya (which currently add up to 30 and counting), this website will henceforth adopt the following spelling which encompasses most (though not all, since since I’ve left out variations that involve the use of a diacritical mark) of the possible spellings:

Q(G)(K)(h)ad(d)af(f)i(y)

- end of initial entry -

Daniel R. writes:

If you wanted to be more systematic, you might consider using what programmers call a regular expression: a way to write a pattern that matches a variety of strings of text. For example, you might write:

(Q|G|K)h?add?aff?(i|y)

The expression (Q|G|K) matches a Q, a G, or a K. The expression h? matches either an h or nothing. Thus the expression above matches both Qaddaffi and Ghadafy. It also matches Qhadaffy, which may be undesirable. But then again, maybe not.

Regular expressions are enormously flexible. For example, you can apply the ? to groups of patterns in parentheses, as in

(Q|G|K)?

Which matches one of those letters, or none at all. You can also use the expression x*, which matches nothing, x, xx, xxx, xxxx, and so forth. With a little knowledge of regular expressions under your belt, you’ll be able to handle any amount of creativity coming out of the AP.

LA replies:

I am familiar with regular expressions from Microsoft Word’s powerful search and replace feature which I’ve used a lot over the years. The only thing unfamiliar to me in what you’ve presented is h? meaning either h or nothing.


Posted by Lawrence Auster at March 21, 2011 11:04 AM | Send
    

Email entry

Email this entry to:


Your email address:


Message (optional):