Would it be possible to use indented lines instead of nested parens to show
a RE?  I always find it easier to see a hierarchy in an outline form.

-----Original Message-----
From: Hal E. Fulton [mailto:hal9000 / hypermetrics.com]
Sent: Tuesday, October 16, 2001 1:53 PM
To: ruby-talk ML
Subject: [ruby-talk:22641] Re: extracting from delimited text files


----- Original Message -----
From: Sean Middleditch <elanthis / awesomeplay.com>
To: ruby-talk ML <ruby-talk / ruby-lang.org>
Sent: Sunday, October 14, 2001 8:55 PM
Subject: [ruby-talk:22543] Re: extracting from delimited text files


> > > > def csv_split(str)
> > > >
str.scan(/(?:\A|,)\s*"((?:\\"|[^"])*)"|(?:\A|,)([^",]*|[^",][^,]*)(?=,|\z)/)
.flatten!.compact!
> > > > end
> > > >
> > >
> > > Jeez, Iit would take me hours to come up with that.  If employers took
> > > regexp's on resumes, you could get a hell of a job with that.  ~,^
> >
> > Hehe thanks.  It's probably more structured than it looks.  For
> > instance you could get rid of the \A's by prepending a leading
> > comma to the string being processed, prior to feeding it to the
> > regexp.  It's really just matching:
> >
>
> Dude, I look at that regexp and my eyes stop seeing color, I start
> seeing dark spots, and little attack sheep start fighting in front of my
> face.  ^,^  I can't even *begin* to parse that stuff.

:)

That reminds me of an idea I had awhile back for a "sub-language"
for regular expressions... I think it might make a neat Ruby library.

If any regex guru is interested, I'll share my notes on the subject...

Hal