[Za-pm] Script
Nick Cleaton
nick at cleaton.net
Wed Jun 4 09:35:27 CDT 2003
On Wed, Jun 04, 2003 at 03:32:35PM +0200, Oskar Pearson wrote:
>
> How about something like this; it anchors on the end-of-line to
> stop people doing something wierd like the following:
> [Sat May 24 12:51:37 SAST 2003] SMS "another at user sent 151 characters to 123123123" <braaidude at hotmail.com> sent 151 characters to 271234567891
>
> my ($email_address) = $_ =~ /([^\s<]+\@[^\s>]+) sent [0-9]+ characters to [0-9]+$/;
>
> I'm assuming the email will always be in the form "text name they supply" <email at address>,
> never <email at address> "something", but I guess that's a resonable assumption?
Yes, that'll work under that assumption.
The trouble is that if the assumption turns out to be wrong it will
fail silently, and the problem may not be noticed. Outputting a
warning in that case might be more useful.
my ($email_address) = $_ =~ /([^\s<]+\@[^\s>]+) sent [0-9]+ characters to [0-9]+$/;
defined $email_address or warn "can't find address in line [$_]";
--
Nick
More information about the Za-pm
mailing list