Great!

Thanks I will give this a try it looks so much cleaner. I did speed it up a
bit by looking to see if the tag needs to run.

Thanks again

Rick Eidson

-----Original Message-----
From: Jim Davis [mailto:jim@;depressedpress.com] 
Sent: Saturday, November 09, 2002 11:01 AM
To: CF-Talk
Subject: RE: Text to URL

> I have been using this CF_URL tag for a while it does just 
> fine exept it is really slow. Does anyone have better 
> solution or a way to speed this up? Thank you

The process itself is a little broken and quite a bit overblown... 

This code runs the REFindNoCase() for every character in the text
instead of first figuring out whether it needs to do anything at all.
The REFindNoCase() itself isn't very effective (why use a list of the
alphabet instead of "[a-z]" or "[[:alnum:]]"). Then it parses the
information painstakingingly character by character instead of using
backreferences.

Lastly even with all that the code is limited to simple ".com" addresses
and doesn't do emails.  ;^)

All in all it's like mowing the lawn with nail clippers.

Here's a RegEx that I stole (with permission) from Dain Anderson's
"CF_ColorCoded" (Dain runs "www.cfcomet.com") custom tag.  I think it
should basically return the same thing you're looking for in one line:

REReplaceNoCase(this,
"([[:alnum:]]*://[[:alnum:]\@-]*(\.[[:alnum:]][[:alnum:]-]*[[:alnum:]]\.
)?[[:alnum:]]{2,}(\.?[[:alnum:]\/=^@*|:~`+$%?_##&-])+)", "<A
TARGET=""_blank"" HREF=""\1"">\1</A>", "ALL")

Here's another for email links:

REReplaceNoCase(this,
"(([[:alnum:]][[:alnum:]_.-]*)?[[:alnum:]]@[[:alnum:]][[:alnum:].-]*\.[[
:alpha:]]{2,})", "<A HREF=""mailto:\1"";>\1</A>", "ALL")

Jim Davis



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Reply via email to