[thelist] regex help

Timothy J. Luoma luomat at operamail.com
Tue Sep 2 18:35:46 CDT 2003


On Tue, 2 Sep 2003 14:37:54 -0700 (PDT), Tom Dell'Aringa 
<pixelmech at yahoo.com> wrote:

> Hello,
>
> I have what is probably a simple regex to do but i cannot figure it
> out. Mainly because I need a variable in my regex. Here is my target
> string:
>
> string = "s1s2s3s4";
>
> from there, I need to remove say "s3".
>
> But the 3 is going to be a variable, say personID. so really I need
> to remove "s" + personID as my regex.
>
> How would I do this?

Is "personID" a fixed length?  How would the regex know when the personID 
had ended?  It is always a number or could it have letters in it?

And finally, what are you trying to do this in?  (because 'sed' might not 
be an option ;-)

TjL


More information about the thelist mailing list