MOO-cows Mailing List Archive
Re: regex substitution
Date: Wed, 6 Mar 1996 22:39:08 PST
Content-Type: text/plain; charset="us-ascii"
>that's what I was going to answer also, but the question was how could you
substitute using regexps: you can only use strsub() to substitute fixed strings.
>Let's take the example that was provided: replacing one or more consecutive
s's with the letter 't'. As you know, the regexp to match s's is "s+". But
since match() returns the index numbers of the matched string.. all you'd
have to do was use those numbers to change the actual string.
Oh yeah, there is another way to do this:
Since both methods only match the first occurrence of the string, you'd
probably have to put it in a while loop.
Subject Index |