up all references to:
"(http://)?((www\.)?mydomain\.(com|net|co.uk)[?
<http://)?((www\.)?mydomain\.(com|net|co.uk)[?&./=[:alnum> &./=[:alnum:]]*)(
|$|[[:cntrl:]])"
and appears to be working fine :)
-----Original Message-----
From: Ben Doom [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 2, 2003 15:21
To: CF-RegEx
Subject: Re: Auto creation of URLs
The only thing stored in the backreference "\1" is what is in the first
set of parentheses. If you were to wrap the whole thing (except the
spaces at the end) in parens, it should work.
I would, however, point out that a more elegant regex might be something
like
rereplacenocase(
string,
"(http://)?((www\.)?mydomain\.com[?&./=[:alnum:]]*)( |$)",
"http://\2",
"all")
might be more elegant. I've not tested this, but it should work with
minimal tweaking.
--Ben Doom
Mike Townend wrote:
> Hi all,
>
> I have a small forum running which removes all html from posting. To
> make it easier to navigate I want to be able to create links if a user
> has entered a link from the site the forum is running on.
>
> I.e.
>
> If some posts a post such as "go to www.hotmail.com its cool" then I do
> not want it to be a link (which it isnt) however if someone posts
> something like... "I like this story www.mydomain.com/foo.cfm" then I
> want it to have a link.
>
> I currently have the following as a Regex which nearly works
>
> <CFSET sRegex =
> "(http://www\.domain\.|www\.mydomain\.)[?&./=[:alnum:]]*([[:space:]]|$)">
>
> <CFOUTPUT>#ReReplaceNoCase(sEntry, sRegex, "<a href=''>\1</a>",
> "ALL")#</CFOUTPUT>
>
> However it doesn�t fill the href with the whole string it matches,
> just www.domain.
>
> Does anyone know how I could amend this so that the whole match is
replaced?
>
> TIA
>
> Mikey
>
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
