develooper Front page | perl.beginners | Postings from April 2002

Re: can anyone help me, please..

Thread Previous
From:
Jonathan E. Paton
Date:
April 27, 2002 05:18
Subject:
Re: can anyone help me, please..
Message ID:
20020427121818.71085.qmail@web14606.mail.yahoo.com
> what do these few matches with?

Please don't ask homework questions on the list, unless you
need something particular explained.  Especially with regex's,
as the best way to describe the complete set of matching
strings is another regex (or more likely, the same one).

> m/(ham|cheese|Big Mac) burgur/

Definately not McDonald's food list - the typo in "burger" doesn't help!  Anyway, it should match:

ham burger
cheese burger

and:

flame grilled gutbusting mega jumbo Big Mac burger with added fat and mechanically recovered GM
meat

> m/(fred){3}+d/

"fred" in a string repeated a multiple of 3 (not including none), followed by a "d"

> tr/A-Z/a-z/

perldoc -f lc

> s!(http|ftp)://((\w+\.)*\w+)((/\w+)*/?)!$2!

I'm not going to even bother with this one... you just don't parse these yourself, unless you
adhere to the specfication or don't mind a hack.  This will fail on legitimate addresses, I think
and should be avoided in favour of proper URL/URI parsers.

Jonathan Paton

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About