regex /[^A-Z]{3,}/)

W

Winston

..
..
while ($name =~ /[^A-Z]{3,9}/) {
print "Invalid, try again: ";
chop($name = uc <STDIN>);
}

Of course that is wrong.

The user must try again if this is true: $name =~ /[^A-Z]/
and this is false: $name =~ /.*{3,9}/
 
P

Paul Lalli

Winston said:
.
.
while ($name =~ /[^A-Z]{3,9}/) {

This is "true" if $name contains 3 or more characters, in sequence,
which are not capital letters. Is that what you meant?

print "Invalid, try again: ";
chop($name = uc <STDIN>);

You want chomp, not chop
}

Of course that is wrong.

Which "that" is wrong, and how is it wrong?
The user must try again if this is true: $name =~ /[^A-Z]/

Now that says that $name contains ANY character that's not a capital
letter. So you're saying $name is invalid if it contains anything
other than capitals?
and this is false: $name =~ /.*{3,9}/

This is meaningless. You can't have a {m,n} quantifier following a *
quantifier. It doesn't make any sense.

Please show example input and output that demonstrates exactly what it
is you're trying to do.

Paul Lalli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top