From: Mike Steiner Date: 2007-06-25T11:01:43+09:00 Subject: Re: regexp questions ------=_Part_39881_7791475.1182736905588 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks for the ideas about the _italics_! I found out what my "weird" problem was - I wasn't double-escaping the \1 in the replacement string (I was using "\1" instead of "\\1".) It's funny how Python didn't require this. Hmmm. Mike Steiner On 6/24/07, Michael Glaesemann wrote: > > > On Jun 24, 2007, at 11:35 , Wyatt Draggoo wrote: > > > On Sun, Jun 24, 2007 at 05:45:30PM +0900, Daniel Lucraft wrote: > > > >> irb> str.gsub(/_(.+?)_/m, "\\1") > > > > I like to be very strict with things like quotes (and underscores > > in this case), so I would probably use: > > > > irb> str.gsub(/_([^_]+)_/, "\\1") > > From a strictness point of view, what's the difference between /(.+?) > _/ and /([^_]+)_/ in the above? AIUI, they're equivalent. I > personally like the former because if you need to change the _ to > some other character, you only have to make a single character change. > > Michael Glaesemann > grzm seespotcode net > > > > ------=_Part_39881_7791475.1182736905588--