From: Kenneth McDonald Date: 2007-08-08T01:55:36+09:00 Subject: Re: Alternate Regular Expressions? Speaking as someone who has actually written and used (in Python) a more abstract regex library, the biggest problem with regular expressions in most languages isn't the syntax, but rather the inability to easily compose small REs into larger REs. Which is why so many programs end up with huge, unreadable REs. As a small example, it's really nice (and obvious) to be able to say re3 = re1 + re2 instead of re3 = "(?:#{re1})(?:#{re2})" And the advantages go well beyond the convenience illustrated in the above example... Also, I think that people who are accustomed to regular expressions (or any other DSL) tend to forget about the problems with that DSL; the need for newcomers to learn another syntax, the inability to use standard language tools with the DSL, and so on. So, though I've used REs for years, I certainly don't agree with the contention that "REs are actually pretty good". RE syntax in RE languages is optimized for quickly entering onetime REs on the command line, not for building robust REs that can be easily maintained by other programmers. It's the difference between weird, Perl-style variables, and meaningful variable names. A good abstract wrapper in Ruby would be very useful. Ken Yossef Mendelssohn wrote: > > I second (or third, or whatever) the contention that regular > expressions are pretty readable on their own (given some knowledge of > the syntax and good formatting). The thing to keep in mind is that > they're a language of their own. Once you learn the language, you > find you can use it in many a programming language (though there are > some dialectical problems here and there). > > -- > -yossef > > > >