procmail
[Top] [All Lists]

Re: Better way of counting characters?

1997-08-26 02:16:26
On Tue, 26 Aug 1997 00:02:10 -0700 (MST), Wotan <wotan(_at_)netcom(_dot_)com>
wrote:
Whats the best way to count the number of characters in a variable?

Scoring is generally good for counting things. 

  :0
  * 1^1 FROM ?? .
  { }
  COUNT=$=

On Tue, 26 Aug 1997 00:17:35 -0700 (MST), Wotan <wotan(_at_)netcom(_dot_)com>
wrote:
I also meant to ask how to test a $FROM for special characters.
llk`jaflasdjfs[aj(_at_)l;fjsdljfasd.com

Let's say we will allow _ and . in addition to alphabetic characters.
(% should be allowed in the localpart for routed mail and then you
might receive mail with an UUCP address or something one day, but if
any of those things ever happen, I'd be suspicious of that, too :-)

  :0:
  * ! FROM ?? [         <][^    a-z(_dot_)_]+(_at_)[^   a-z._]+([       >].*)?^^
  spam

Odd things will happen with anything which looks "confusing" but you
might expect that, too, to be malicious. (Some people will of course
use something like "me@" <me(_at_)my(_dot_)address(_dot_)net> (@comment) just 
to see if
they can break things but they probably shouldn't count on their mail
getting through all of the time then :-)
  If you really want to follow the rules, RFC822 will prove to be good
reading. A lot of odd characters are allowed if you just quote them or
something.

Hope this helps,

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

<Prev in Thread] Current Thread [Next in Thread>