Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #655
| From | Paul Wankadia <junyer@gmail.com> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: Inverse grep |
| Date | 2012-05-28 07:50 -0700 |
| Organization | Compilers Central |
| Message-ID | <12-05-026@comp.compilers> (permalink) |
| References | <11-06-015@comp.compilers> |
On Jun 9 2011, 9:01 am, glen herrmannsfeldt <gah@ugcs.caltech.edu> wrote: > I suppose this is a strange question, but I was wondering if > there was ever something like an inverse grep. That is, > match a string against a file full of regular expressions. > > Now, one could just read the file, compile the regex one at > a time, and do the match, but maybe there is another way. The best way to match lots of regular expressions is not to match lots of regular expressions. :) In a nutshell, extract the fixed substrings of the regular expressions, identify which of the fixed substrings (if any) are present in the input string and determine which of the regular expressions (if any) are worth trying to match. The RE2 library includes this functionality, but you will need to BYO Aho-Corasick implementation. Refer to http://code.google.com/p/re2/source/browse/re2/filtered_re2.h.
Back to comp.compilers | Previous | Next — Previous in thread | Find similar | Unroll thread
Inverse grep glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2011-06-08 23:01 +0000
Re: Inverse grep Chris F Clark <cfc@shell01.TheWorld.com> - 2011-06-12 14:16 -0400
Re: Inverse grep Tony Finch <dot@dotat.at> - 2011-06-13 17:48 +0100
Re: Inverse grep torbenm@diku.dk (Torben Ægidius Mogensen) - 2011-06-14 11:16 +0200
Re: Inverse grep anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-06-15 12:28 +0000
Matching very large patterns, was Re: Inverse grep Chris F Clark <cfc@shell01.TheWorld.com> - 2011-06-19 21:45 -0400
Re: Matching very large patterns, was Re: Inverse grep glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2011-06-20 04:52 +0000
Re: Inverse grep Paul Wankadia <junyer@gmail.com> - 2012-05-28 07:50 -0700
csiph-web