Don't do the replace, just don't include the {} in the REreplace.
Although I may have overlooked something: You really should do a
URLEncodedFormat() of the word (which doesn't work with the
backreferencing).

function MakeLinks(text,dictionary){
var st = StructNew();
var start = 1;
var word = "";
var link = "";
while(true){
st = REFind("\{([^{}]+)\}",text,start,true);
if(st.pos[1] IS 0) break;
word = Mid(text,st.pos[2],st.len[2]);
text = RemoveChars(text,st.pos[1],st.len[1]);
link = "<a
href=""> dFormat(word)#"">#word#</a
>";
text = Insert(link,text,st.pos[1]-1);
start = st.pos[1] + Len(link);
}
return text;
}

Pascal

> -----Original Message-----
> From: Paul Vernon [mailto:[EMAIL PROTECTED]
> Sent: 13 July 2004 19:06
> To: CF-Talk
> Subject: RE: FIXED - Regular _expression_ help with dictionary
definitions
>
> > PS Give the REReplace with the backreferencing (see my previous
post) a
> > shot. It is only 1 line to do the same thing.
>
> Pascal, you are a STAR!
>
> The backreferencing wasn't quite there as I wanted to remove all of
the
> extra parentheses also but a simple replacelist wrapped around your
> elegant
> solution fixed that...
>
> The results can be seen at
> http://www.web-architect.co.uk/cfx_dict.cfm?dictionary=web1913
> <http://www.web-
> architect.co.uk/cfx_dict.cfm?dictionary=web1913&phrase=Fungi
> > &phrase=Fungi
>
> Thanks again
>
> Paul
>
>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to