I'm trying to write a regexp.
some background info: I am try to see if the REQUEST_URI of my website's URL contains another URL. like these:
- http://mywebsite.com/google.com/search=xyz
However, the url wont always contain the 'http' or the 'www'. so the pattern should also match strings like:
- http://mywebsite.com/yahoo.org/search=xyz
- http://mywebsite.com/www.yahoo.org/search=xyz
- http://mywebsite.com/msn.co.uk'
- http://mywebsite.com/http://msn.co.uk'
there are a bunch of regexps out there to match urls but none I have found do an optional match on the http and www.
i'm wondering if the pattern to match could be something like:
^([a-z]).(com|ca|org|etc)(.)
I thought maybe another option was to perhaps just match any string that had a dot (.) in it. (as the other REQUEST_URI's in my application typically won't contain dots)
Does this make sense to anyone? I'd really appreciate some help with this its been blocking my project for weeks.
Thanks you very much -Tim
See Question&Answers more detail:os