> > Although not recommended in general, this solution will deliver decent > > performance in your case. > > As the system we try to emulate is a Python library, the performance > should be comparable. > > > The other solution would be to use pregexp (your first intuition) but > > as pregexp requires a string, you will have to read the whole file in > > memory first, which means that this solution will only work for toy > > examples. > > > As a side note, if your pattern is basic regular expression only made > > of sequences of characters, then you might prefer using KPM and mmap. > > KMP, I suppose? We need Regexps more complex than just strings. But I am Yes. Sorry for the typo. KMP.
> curious about the way Perl manages multi-lines queries, we would do the > same. If the pattern you are looking for is statically known, then of course, compile the grammar. This will deliver the best result. My guess is that is it will be significantly faster then traditional regular expressions, but this has to be verified. Cheers, -- Manuel
