From: Michael Glaesemann Date: 2007-06-25T03:20:38+09:00 Subject: Re: regexp questions 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