MOO-cows Mailing List Archive
[Prev][Next][Index][Thread]
Re: regex substitution
-
Date: Wed, 6 Mar 1996 21:06:36 PST
-
From: bolie@io.com (Bolie Williams IV)
-
Content-Type: text/plain; charset="us-ascii"
>At 09:42 PM 3/4/96 PST, slayer@kaiwan.com wrote:
>>>Is there a verb which does substitution based on regex pattern
>>>matching? $string_utils:substitute doesn't, but it would be nice
>>>if it did. If not, then does someone have some pre-written code
>>>which does this. I'd rather not write it myself if it's already
>>>been done. :)
>>
>>doesn't the builtin function substitute() perform this function?
>
>I believe what you'd want to do is this:
>
>substitute("%NTH-PARENTHESIS",match(to-be-matched,regexp-expression))
>
>I suggest looking at the help in the Programmer's Manual under 'match' and
>'substitute'
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.
Do you know of a way to do this?
---------------------------------------------------------------w-w---
Bolie Williams IV ( ^ )
Systems Administrator (O O)
Rice University v-v
----- bolie@io.com - bolie@rice.edu - http://www.io.com/~bolie/ -----
Home |
Subject Index |
Thread Index