Regular expression only for website

Posted by Katie on Stack Overflow See other posts from Stack Overflow or by Katie
Published on 2010-05-26T12:57:36Z Indexed on 2010/05/26 14:31 UTC
Read the original article Hit count: 269

Filed under:

HI, I'm new to Regular Expression. I need to find just website in some text and I'm looking for a regular expression able to find out strings like:

www.my.home, http://my.site.it

But this regular expression should not find strings like:

[email protected] or if the website is already inside html tag

<a href="http://www.my.site.com/"><span style="font-style: normal;">www.mambo-test.org</span></a>

I tried with this one:

\b((https?://[^ ])|(www.[^ ]))

but it also finds the website in the href and between the tag:

<a href="http://www.my.site.com/"><span style="font-style: normal;">www.mambo-test.org</span></a>

and I don't know how except this case.

© Stack Overflow or respective owner

Related posts about regex