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

K

Karl Seguin

use ^ at the start of your regular expression to say "from the start" ($ is
at the end...)

^www

if you want to ignore trailing/leading spaces, you'll either have to trim or
use explicit capture...^\s*(www)

or something like that...

Karl
 
H

hooterbite

Karl -
Thanks for your reply.
That seems to only work if www is the start of the string, not if it is
in the
middle of a string.
 
K

Karl Seguin

Not sure I know what you want then?

www proceeded by anything? by only certain things?

Karl
 
H

hooterbite

Yes. I need to go through a paragraph of text and activate the links.
Some of them are good as they are - starting with http://. Others are
not - they start with www. So I need to find the www ones and add the
http:// before it. But I only want to do it if there is not already an
http:// before it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top