H
Huajian Luo
Hi there,
I need to state the following name convention by perl regular
expression.
"valid names are comprised of only alphanumeric characters
plus the characters '-', '_', and '.'. Names must begin
with a letter.
I've tried the following function
sub valid_name{
my $name = $_
if ($name !~ /*[!a-zA-Z0-9_.-]* | [!a-zA-Z]*/) {
print "Name $name is not valid";
} else {
print "MMMMMMMMMMMMMMMMMMMMM";
}
but it doesn't work.
Any hints on t his?
I need to state the following name convention by perl regular
expression.
"valid names are comprised of only alphanumeric characters
plus the characters '-', '_', and '.'. Names must begin
with a letter.
I've tried the following function
sub valid_name{
my $name = $_
if ($name !~ /*[!a-zA-Z0-9_.-]* | [!a-zA-Z]*/) {
print "Name $name is not valid";
} else {
print "MMMMMMMMMMMMMMMMMMMMM";
}
but it doesn't work.
Any hints on t his?