Alex,
Did you get the problem fixed? Yes it was because you did not escape your . when
you wanted a .
instead of an any character.
..[a-zA-Z]{2,3} will match ".abc", but it will also match "abcd" but \.[a-zA-Z]{2,3}
will require
that the first character this part of the regular expression matches is a period, not
an any
character.
Regards,
David
----- Original Message -----
From: "alex" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 19, 2002 10:16 AM
Subject: regex - problem
Hi,
I have this unsignificant problem: I try to match an email-adress...
works, EXCEPT the very last .com or .de ... it matches .com and .de
but not .d nor .x - ok so far.
but it also matches .dererere - which it shouldn't. I used the {2,3}
but it seems, that the max-count is being ignored.
any ideas? thanks in advance
if (@ARGV != 1){
print "ONE PARAMETER ONLY!!!\n"
} else {
if ($ARGV[0] =~
/^([_a-zA-Z0-9-]+)(.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+)(.[a-zA-Z0-9-]+).[a-zA-Z]{2,3}$/){
@a = split /@/,$ARGV[0];
print "user: $a[0]\ndomain: $a[1]\n";
print "MATCH\n";
}else{
print "MISMATCH\n";
}
}
--
cheers
alex mailto:[EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]