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

Re: can anyone help me, please..

Thread Previous
Jonathan E. Paton
April 27, 2002 05:18
Re: can anyone help me, please..
Message ID:
> 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


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

> 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

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About