I have such regexp:
But that doesn’t include hashbangs
(#!). What I need to change, to get it working? I know I can add ! to group with
#@% etc, but that will select something like
Check this out: http://example.com/something/!!!
and I want to avoid that.
Don’t try to make your own regular expression for matching URLs, use someone else’s who has already solved such problems, like this one.
It could be very long but in practice mine works pretty good. Please try this one
It matches all of the example below
http://wwww.stackoverflow.com abc.com http://test.test-75.1474.stackoverflow.com/ stackoverflow.com/ stackoverflow.com firstname.lastname@example.org http://www.example.com/etcetc www.example.com/etcetc example.com/etcetc user:email@example.com/etcetc (www.itmag.com) example.com/etcetc?query=aasd example.com/etcetc?query=aasd&dest=asds http://stackoverflow.com/questions/6427530/regular-expression-pattern-to- match-url-with www/Christina.V.Scott@gmail.com firstname.lastname@example.org. email@example.com firstname.lastname@example.org
I’ll admit that I’m a little bit worried about an application that requires a regex like that to match URLs. That said, this seems to work for me:
This is a common problem, use default libraries.
For python use urlparse