1/18/2011, "Alexey Mishustin" <shum...@shumkar.ru> вы писали:

>
>1/18/2011, "Grant" <emailgr...@gmail.com> вы писали:
>
>>> I'm trying to come up with a regex that will match any Google Images
>>> URL such as these:
>>>
>>> www.google.com/imgres
>>> www.google.com/images
>>> google.com/imgres
>>> www.google.co.uk/imgres
>>> www.google.nl/imgres
>>>
>>> and a second regex for Google Products URLs of which this is one example:
>>>
>>> www.google.com/url?sa=t&source=productsearch
>>>
>>> but my pathetic regex "skills" aren't cutting it.  Can anyone help me
>>> out?  Is there a perl module for this?
>>>
>>> - Grant
>>
>>I came up with these but they don't seem to work reliably:
>>
>>/\.google\..*\/imgres\?/
>>/\.google\..*\/images\?/
>>/\.google\..*\/products\?/
>
>/(www.){0,1}(google\.).*\/(imgres)|(images)|(products)\?{0,1}/

Sorry, forgotten 1 backslash:

/(www\.){0,1}(google\.).*\/(imgres)|(images)|(products)\?{0,1}/

The first regexp works too, but it matches more than necessary.

--

Regards,
Alex

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to