From: Tom Allison Date: 2006-04-12T03:23:26+09:00 Subject: Re: regex flags On 4/11/2006, "Logan Capaldo" wrote: > >On Apr 11, 2006, at 1:50 PM, Tom Allison wrote: > >> >> Generically, how do you impliment the various flags? >> >> I figured out: s/ / /g --> gsub >> and s/ / / -> sub >> >> What about something like >> / /ixsmg >> or various combinations thereof? >> > >i and x are both there, in the same way, as well as m >e.g. > >/ /i >/ /x >/ /ix >/ /m > >The only reason /g doesn't really work is that ruby doesn't have a >s/// operator (I guess it's an operator) and that modifier applies >more to the substitution than the regexp itself. > I frequently use a perl approach of while ($arg =~ /(string_thing)/igsm) { # use $1 here } to pick out chunks of a string as an iteration through the string. This would require a 'g' without the 's'. No chance?