#ifndef REGEX_REGEX_HPP #define REGEX_REGEX_HPP #include #include // some simple pcre wrapper code lifted out of stepmania, i think // usage: // // regex::regex re("([a-zA-Z]+)-([a-zA-Z+)"); // // if (re.compare("test-test")) { ... } // // std::vector matches; // if (re.match("abcd-efgh", matches)) { operate on matches; } namespace regex { class regex { public: regex(); regex(const regex& copy); regex(const std::string& str); ~regex(); void set(const std::string& str); std::string get() const; bool compare(const std::string& comp); bool match(const std::string& comp, std::vector& matches); regex& operator=(const regex& rhs); regex& operator=(const std::string& rhs); private: void compile(); void release(); void* m_re; std::string m_pattern; int m_backrefs; }; } #endif