Link to home
Start Free TrialLog in
Avatar of hankknight
hankknightFlag for Canada

asked on

ASP.NET / VB / REGEX: Automatically create links beginning with www at beginning

I use the following code to make links clickable where the link begins with www.

input = RegularExpressions.Regex.Replace(input, "(\www\.\S+[^\s@,.""']+)", "<a href=""http://$1"">$1</a>")

Open in new window


The problem is that this becomes clickable links:
zwww.example.com
/www.example.com
>www.example.com

It should ONLY become a clickable link if it starts with www and does not have another charactor (other than whitespace)
ASKER CERTIFIED SOLUTION
Avatar of Terry Woods
Terry Woods
Flag of New Zealand 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