On Apr 11, 7:21 am, gklc...@googlemail.com (gkl) wrote:
> On Apr 10, 11:03 pm, jwkr...@shaw.ca ("John W. Krahn") wrote:
stion on regular expressions as my
> > > program is working fine but I was just curious.
>
> > > Say you have the following URLs:
>
> > >http://www.test.com/image.gif
> > >http://www.test.com/?src=image.gif?width=12
 ....
>
> OK. So if I understood you correctly, given the following (actual)
> URLs
>
> http://beta.images.theglobeandmail.com/archive/01258/election_heads__...http://storage.canoe.ca/v1/dynamic_resize/?src=http://www.torontosun....
>
> the following pattern
>
> ^\s*.*\.([a-zA-z]{3})$ | ^\S*\?\S*\.([a-zA-z]{3})&.*$
>
> should match them both. Am I correct?
>

No, there is at least one problem. In your first
alternative, the '.*'  will  also match the literal '?'
which the second alternative is matching.

 See: 'perldoc perlretut' for a review.

[ The  URI module which was mentioned will
 be a quicker solution and will work work all
 cases. ]

--
Charles DeRykus


See: perldoc perlretut


--
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