Link to home
Start Free TrialLog in
Avatar of alternativeit
alternativeit

asked on

Regex needed to change urls to a href's (links) within a string; Coldfusion

I'm looking for a Coldfusion code snippet to parse a block of text and convert any of the following plain text sub-strings:

http://www.site.com
http://www.site.com/example/123.htm
www.site.com
www.site.com/example/123.htm
subdomain.site.com
subdomain.site.com/example/123.htm

to hyperlinks.

I know this can be done using the rereplacenocase command; I just don't know how! :) I've never really understood regex's and need this ASAP to finish off some work on a site.

An example of how to do this in PHP is here:
http://immike.net/blog/2007/04/06/5-regular-expressions-every-web-programmer-should-know/
...under the 'Matching a URL' heading.

Basically, I'd like some code to replicate this in Coldfusion (MX7).
ASKER CERTIFIED SOLUTION
Avatar of azadisaryev
azadisaryev
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alternativeit
alternativeit

ASKER

Perfect. Thanks! :)