Jeff, Rob, Michael (and others who reply while I write this)

Very many thanks.. :)  I still don't have regexp down very well and this has
been frustrating me for several hours now..  This is why I love this list,
several helpful people with lots of good help.. :)

Its up and running now.. basically what I am doing is writing a page
templating system for my websites so I can swap page templates in and out
and easily modify content by storing it in a database... (lazy man hates
extra work so he spends a long time making a time savings device)


--
 Patrick Spence, MIS
 Mayor Pharmaceutical Labs/Regency Medical Research, Ltd.
 2401 South 24th Street, Phoenix, AZ  85034
 [EMAIL PROTECTED] - http://www.vitamist.com

 *** All contents of this email message are confidential
 and private.  Please do not forward to anyone that this
 message is not intended for without permission.

 If you have received this email in error, please contact
 the sender and then delete all copies of the message
 that you have.  Thank you. ***

----- Original Message -----
From: "Jeff Hobbs" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 22, 2002 2:26 PM
Subject: Re: [AOLSERVER] TCL question


> Patrick Spence wrote:
>         ...
> > proc insert_macro { thestring key macro} {
> >     regsub -all -- $key $thestring $macro thestring;
> >     return "$thestring"
> > }
>
> It's not quite clear from your explanation what you really want, and
> how you want the & handled.  However, I suspect that 'string map'
> would make your life easier, if you are doing direct string mapping.
> This would be like:
>
> proc insert_macro {str searchStr replaceStr} {
>     return [string map [list $searchStr $replaceStr] $str]
> }
>
> string map takes any number of pairs.  This is new since Tcl 8.1,
> but the latest stable AOLServer is using 8.3.
>
> Otherwise if you really want to replace something based on a
> regular expression, then you probably need to escape the subspec
> if it has &'s or \'s in it.
>
>   Jeff Hobbs                     The Tcl Guy
>   Senior Developer               http://www.ActiveState.com/
>       Tcl Support and Productivity Solutions

Reply via email to