Help beautify ugly heuristic code

Stuart D. Gathman stuart at bmsi.com
Mon Jul 24 23:51:51 EDT 2006


On Thu, 09 Dec 2004 00:01:36 -0800, Lonnie Princehouse wrote:
 
> I believe you can still do this with only compiling a regex once and
> then performing a few substitutions on the hostname.

That is a interesting idea.  Convert ip matches to fixed patterns, and
*then* match the regex.  I think I would convert hex matches to the same
pattern as decimal (and roman numeral).  How would you handle zero fill?

1.2.3.4	001002003004foo.isp.com

An idea I had last night is to precompile 254 regexes - one for each of
the possible last ip bytes.  However, your idea is cleaner - except, how
would it handle ip bytes that are the same: 1.2.2.2

Mitja has proposed a scoring system reminiscent of SpamAssassin.

This gives me a few things to try.

-- 
	      Stuart D. Gathman <stuart at bmsi.com>
Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flamis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.




More information about the Python-list mailing list