From: James Britt Date: 2004-11-19T04:26:08+09:00 Subject: Tales of the Regex (Re: About Regular Expressions) James Edward Gray II wrote: > On Nov 18, 2004, at 9:44 AM, trans. (T. Onoma) wrote: > >> My opinion is this: Regexp's are for CS-heads --those who really love >> programming for its it's own sake. Regexp are about as terse and >> cryptic as >> one can get, and thus have a steep learning curve. > > > My experience has been the opposite. > > At my wife's company, they spend a significant portion of everyday > importing raw text reports from their database into Excel for various > uses. Some of the reports do not go into Excel well at all. A large > chunk of most employee's day is spent cleaning up these reports, by > hand. (I'm considering one of these reports for a future Ruby Quiz, if > that gives you any idea how wonky they can be.) > ... My experience is that I use REs on a sporadic basis, and tend to learn and remember just enough to get a task done. But by the time I need to write another RE, if it isn't something trivial, I have to go looking for docs and such. And the docs often do not explain how to do certain things, or tell me if it is even possible. (An example: Can I write an RE that tells me if a given string contains all substrings in a given set of substrings, irrespective of the order of the substrings in either the target string or the set of substrings? ) But, to be fair, some of these sorts of requests may be beyond a basic cookbook or newbie intro Web page. So, it's either get the O"Reilly book, post a question, or hack away. In general, I don't really care if people are too lazy to look things up, if they don't make it a regular habit and overrun the list. I scan message headers, do a sort of triage for attention, and ignore many, many things. Pretty painless. So, stupid questions are welcome. (I'd hate to feel reluctant to ask a stupid question myself; I have too many of them.) One a side note, I wonder what it would take to write a domain language, parable by Ruby, that let one write REs in plain-ish English? Maybe take some of the mystery out of regular expressions for most of the common cases. (Or would that just get people dependent on too much hand-holding?) James