|C regexp package that can save compiled expressions? firstname.lastname@example.org (John R Levine) (2004-08-13)|
|Re: C regexp package that can save compiled expressions? email@example.com (George Neuner) (2004-08-15)|
|Re: C regexp package that can save compiled expressions? firstname.lastname@example.org (glen herrmannsfeldt) (2004-08-15)|
|Re: C regexp package that can save compiled expressions? email@example.com (Carl Barron) (2004-08-15)|
|Re: C regexp package that can save compiled expressions? firstname.lastname@example.org (Carl Cerecke) (2004-08-15)|
|From:||"John R Levine" <email@example.com>|
|Date:||13 Aug 2004 17:35:41 -0400|
|Posted-Date:||13 Aug 2004 17:35:41 EDT|
Does anyone know of a regular expression package that lets you save
the compiled expression in a file and load it into an application
A fairly effective anti-spam technique is to look at the reverse DNS
of incoming connections and to reject connections that come from known
blocks of dialup and otherwise poorly secured computers. You can
generally write a regular expression for the rDNS of each pool, but
there's a lot of pools, thousands of them, so on each incoming
connection the rDNS needs to be matched against thousands of regular
Since you don't care which pattern matches, only whether it matches or
not, an obvious optimization would be to combine all of the patterns into
one big honking RE "pattern1 | pattern2 | ... | pattern N" and match the
rDNS against that, since the RE match time is proportional to the length
of the target string, not the complexity of the expression. The compile
time would be long, but the list of patterns changes rarely so one
compiled copy of the pattern would be used many times.
I could do this in flex, but that's not really the right tool since the
set of patterns does change now and then, and I don't need flex's ability
to run different code for each pattern.
So are there C regexp routines with a separate compiler? There used to be
one shipped with some versions of Unix, but I can't find it any more. The
standard regexp libraries are based on Henry Spencer's which compiles but
not into code you can dump out and reload.
John Levine, firstname.lastname@example.org, Primary Perpetrator of "The Internet for Dummies",
Information Superhighwayman wanna-be, http://iecc.com/johnl, Mayor
"I dropped the toothpaste", said Tom, crestfallenly.
Return to the
Search the comp.compilers archives again.