#ifndef __SD_CORE_REGEX_H__ #define __SD_CORE_REGEX_H__ #include #include #include #include #include namespace sd { class Regex { struct Impl; std::unique_ptr impl_; public: using Match = std::pair; Regex(); ~Regex(); Regex(Regex&&) noexcept; Regex& operator=(Regex&&) noexcept; // Failed compilation leaves the previous expression intact. bool compile(const std::string& pattern, std::string* error = nullptr); // Matches are non-overlapping UTF-8 byte ranges; each call owns its search state. bool find_matches(const std::string& text, std::vector& matches, std::string* error = nullptr) const; }; } // namespace sd #endif // __SD_CORE_REGEX_H__