Here you go

<cfset secondstring = "here is my email address [EMAIL PROTECTED] bla
bla test">
<CFSET NewString = REReplaceNoCase(
secondstring,"([[:space:]]|^)([-_[:alnum:]]+(\.[-_[:alnum:]]+)*@[-[:alnu
m:]]+(\.[-[:alnum:]]+)*\.(([[:alpha:]]{2,3})|(aero|coop|info|museum|name
)))([[:space:]]|$)", '\1<A HREF="mailto:\2";>\2</A> ', "ALL")>

Watch out for unintended page breaks in the regexp due to the reply.
There is a hardcoded space after the </A>

Pascal

-----Original Message-----
From: Steven Ritchie [mailto:[EMAIL PROTECTED]] 
Sent: donderdag 25 april 2002 11:46
To: CF-Talk
Subject: Tricky piece of code


Hi,
        I'm new on this list so forgive me for jumping right in! I have
a string with an email address in it say 'my email is [EMAIL PROTECTED]
blah blah' I need a custom tag that searched through the string and
creates a <a
href> tag for it i.e. it ends up outputting 'my email is <a
href="mailto:[EMAIL PROTECTED]";>[EMAIL PROTECTED]</a> blah blah'

Any ideas?

There's also a case where there could be more than a single email
address in a string...

______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to