From: Ari Brown Date: 2007-08-08T02:44:27+09:00 Subject: Re: Alternate Regular Expressions? Thanks! I was actually thinking about this myself. Please people, send an email if you want to see something in a Ruby RegExp wrapper. Don't be shy. If i can get drafted into making this, then you can tell me what you want to see. Thanks, Ari On Aug 7, 2007, at 12:55 PM, Kenneth McDonald wrote: > 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: --------------------------------------------| If you're not living on the edge, then you're just wasting space.