simple linear-time regex library in C++ that runs character at a time