an implementation of regexes in c++