A clean implementation of Sun Wu and Udi Manber's bitap algorithm.
<open source advocacy start>
This code is in the public domain. Recognition of the unpaid work by the
author (Nic Roets) will be appreciated. The program has no warranty.
The rationale for placing the program in the public domain is that it is the
best way to achieve the optimum economic use for this "economic resource".
Now programmers are free to achieve higher goals.
</open source advocacy end>
Update : 14 Apr 2005 : Fixed bug (core dump) reported by Mike
Sheridan
Update : Used in wxMusik -
Gunnar Roth (16 Oct 2004)
Update : Thanks to Scott Bronson for the patch
Update : TRE agrep is a similar
opensource project
I concentrated on keeping this code as simple as possible*.
Nevertheless it
is quite fast compared to other greps, due to the bitap algoritm, and
modern CPU architechture. Modifying the code for special cases will speed
things up even futher.
Note that the complete 'search' string must be matched by the pattern. If
you want to search for substrings of the search string, prefix and postfix the
pattern with '.*'.
Bug list: