From: James Edward Gray II Date: 2007-01-27T01:49:47+09:00 Subject: Re: simple question about Ruby Regext On Jan 26, 2007, at 10:44 AM, Peter Bailey wrote: > James Gray wrote: >> On Jan 26, 2007, at 8:45 AM, Peter Bailey wrote: >> >>> >>> Thanks, Wolfgang. So, you suggest the use of "scan" instead of >>> "gsub?" >>> That would imply the need for a block, which, seems kind of wordy, >>> but, >>> it does have power. . . . Thanks again. >> >> gsub/gsub! also take a block. >> >> Which one you use depends mainly on your purpose. Here's how I view >> the methods, in terms of a "Find and Replace" feature set common to >> so many programs: >> >> sub/sub! == Find >> gsub/gsub! == Find and Replace >> scan == Find All >> >> Hope that helps. >> >> James Edward Gray II > > That does help, James. Thanks. But, don't "sub" and "sub!" do a > replacement; so, they're doing more than just finding? At least, > they're > finding and replacing the first instance of whatever, just not > globally? Ick. Sorry. In my defense I only got four hours of sleep last night. Let me try my chart one more time: sub/sub! == Find and Replace gsub/gsub! == Replace All scan == Find All James Edward Gray II