MOO-cows Mailing List Archive


Re: regex substitution

>At 09:06 PM 3/6/96 PST, Bolie Williams IV wrote:
>>What I want to do is take an arbitrary string and substitute one
>>string for arbitrary substrings.  For example, substitute an 's' or
>>any number of 's's with the letter 't'.  Using sed, I'd just do a
>>s/ss*/t/ or s/s+/t/ (I think).  I'm going to be substituting in arbitrary
>>text, though, so I don't have the luxury of marking my substitutions
>>with %'s.
>Oh, I see:
>;strsub("What the fuck is STRSUB???","fuck","fudge")
>=> "What the fudge is STRSUB???"

That's fine... what I *want* is this:

;strsub("Can we be more patronizing?","mm*","b")
=> "Can we be bore patronizing?"

but what I get is this:

=> "Can we be more patronizing?"

I have looked at the builtins and at $string_utils and it doesn't
look like anything does that.  I am curious if someone has written
something that does do this or if I'm missing something...

Bolie IV

Bolie Williams IV                                             ( ^ )
Systems Administrator                                         (O O)
Rice University                                                v-v
----- - - -----

Home | Subject Index | Thread Index