=~ m/^(\w+).*\(\w+)@(\w+).*\.(\w+)$/
Would match [EMAIL PROTECTED]
[EMAIL PROTECTED]
But not
joemama@joemam
Or [EMAIL PROTECTED]
There is even a better way to do it instead of the .* which will match
Joemama~$%&*(()_)+=-:"{}|?><hi@hi~!#%^&*().com
Which is obviously bad but this is at least somewhat more strict but not perfect
Dan
> -----Original Message-----
> From: Dylan Boudreau [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 15, 2003 10:58 AM
> To: [EMAIL PROTECTED]
> Subject: Checking to see if input has valid data.
>
>
> The input must be an email address and I am checking it the following
> way:
>
> print "Enter an address to replace: ";
> chomp (my $search = <STDIN>);
> unless ($search =~ /@/){
> die "Search field must be an email address!\n";
> }
> print "Enter a replacement address: ";
> chomp (my $replace = <STDIN>);
> unless ($replace =~ /@/){
> die "Replacement field must be an email address!\n";
> }
>
> This does work but I am sure there must be a better way. The
> whole program is a search and replace utility for email
> addresses on all our mailing lists so when someone changes
> their address I don't need to change it manually on 20 lists.
> Does anyone see a better way of doing this?
>
> Dylan
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]