>===== Original Message From Bob Kline <bkline / rksystems.com> =====
>On Sat, 24 Mar 2001, Kevin Smith wrote:
[...]
>> [goals that don't mention Perl-like embedded regex documentation]
>>
>> I think that's about it. Otherwise, it looks great :-)
>
>You mean Ruby doesn't support embedded documentation for regular
>expressions (the only way I know of for alleviating regex ugliness), the
>way Perl does?  In that case, the man-page marketing is even more
>amusing than I originally thought. :->}

The /x modifier for regular expressions was one of the things
about Perl that Matz liked, therefore it was borrowed in Ruby.

That said, I have found that most attempts to make REs more
verbose to make them readable tend to make the code harder to
read.  While I think it is a great *learning* tool, I tend to
think that if you feel the need for it in production, then you
are using REs for something they are not suited for, there is
probably a simpler way to cut the problem up.

But that said, one of my all-time favorite modules in Perl is
written by Jeff Pinyan.  You feed it an uncommented RE and it
parses it and hands back a verbosely commented version of the
same using the /x modifier.  He used to have it online until
it grew so popular that requests were chewing up a quarter of
the CPU of the machine it was on.

You can download it from:

http://search.cpan.org/search?dist=YAPE-Regex-Explain

I promise that it will be truly helpful in figuring out what
REs mean and how they work or you get double your money back!

Cheers,
Ben