A complete regular expressions C++ solution