From: David Alan Black Date: 2002-07-24T00:38:08+09:00 Subject: Re: Strings and member-operators Hi -- On Wed, 24 Jul 2002, George Ogata wrote: > David Alan Black wrote: > > > Hi -- > > > > On Tue, 23 Jul 2002, Dossy wrote: > > > >> On 2002.07.23, David Alan Black wrote: > >> > class String > >> > def stripQuotes > >> > /^("?)(.*?)(\1)$/.match(self)[2].strip > >> > end > >> > end > > Is there an advantage to using .*? there instead of .*? (That second '?' > there is punctuation, not part of the regex). Or would there be no > difference at all, assuming there were no newlines in the matched string? > Speaking of which, isn't it an idea to turn on the mutliline flag? Or use > \A...\z? You could butcher something like: > > "Some quote" > --- Some guy. Hmmmm... Like the other thing Dossy pointed out (putting () around \1), I think the ? was left over from some intermediate version where it mattered. OK, so now we're looking at: /^("?)(.*)\1$/.match(self)[2].strip I hadn't addressed the whole multi-line issue -- it wasn't in Dossy's test suite :-) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav