whatluo has asked for the wisdom of the Perl Monks concerning the following question:
I need to check the name to conform to the following conventions: valid names are comprised of only alphanumeric characters(a-z A-Z and 0-9) plus the characters '-', '_', and '.'. Names must begin with a letter.
someone told me to use this
$name =~ /\A[a-zA-Z][\w.-]*\z/;
but it treat "s@--__" and "s!!!@@@___" to valid which should be invalide name, casue \w in perl include @ and ! and punction sign, Any hints on this?
Thanks,
--Whatluo
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: how to state this by REL
by pg (Canon) on Nov 09, 2005 at 06:57 UTC | |
by whatluo (Novice) on Nov 09, 2005 at 08:08 UTC | |
by Aragorn (Curate) on Nov 09, 2005 at 09:31 UTC | |
Re: how to state this by REL
by Errto (Vicar) on Nov 09, 2005 at 06:00 UTC | |
Re: how to state this by REL
by reasonablekeith (Deacon) on Nov 09, 2005 at 11:07 UTC | |
by herveus (Prior) on Nov 09, 2005 at 13:43 UTC |