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

  • Thread starter Thread starter hooterbite
  • Start date Start date
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
 
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.
 
Not sure I know what you want then?

www proceeded by anything? by only certain things?

Karl
 
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.
 
Back
Top