469,945 Members | 2,267 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,945 developers. It's quick & easy.

Regular Expression - looking to match 'www' only if it is the start of a URL

I need to loop through paragraphs of text and "activate" the links,
which could either have the http:// or just start with www.
I have no problem finding the ones that start with http://. The problem
arises when I want to find the ones that start with www, because the
string has to start with www, I dont want to match the www in
http://www, since I would have activated that one already when it came
up as a match for the http.

The things I have tried are:

If the string is: www.google.com and I use this regular expression:
"\\swww\\S*" returns " www.google.com", with the space before the www.

If the string is : http://www.google.com and I use:
"\\dwww\\d\\S*" matches, seems like it doesn't mind the http:// before
the www.

I want to match the string www.google.com, not http://www.google.com,
and I don't want the space that the first regular expression

Nov 19 '05 #1
0 919

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Bradley Plett | last post: by
11 posts views Thread by Dimitris Georgakopuolos | last post: by
43 posts views Thread by Roger L. Cauvin | last post: by
3 posts views Thread by Zach | last post: by
25 posts views Thread by Mike | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.