From: Peter Bailey Date: 2007-01-27T01:44:59+09:00 Subject: Re: simple question about Ruby Regext 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? -- Posted via http://www.ruby-forum.com/.