regex.hpp 518 B

12345678910111213141516171819202122
  1. #ifndef AFUN_REGEX
  2. #define AFUN_REGEX
  3. #define PCRE2_CODE_UNIT_WIDTH 8
  4. #include "pcre2.h"
  5. #include "aFunToolExport.h"
  6. namespace aFuntool {
  7. const int REGEX_ERROR_SIZE = 512;
  8. class Regex {
  9. pcre2_code *re; // 正则表达式
  10. const std::string pattern; // 正则表达式的字符串
  11. public:
  12. AFUN_TOOL_EXPORT explicit Regex (const std::string &pattern_);
  13. AFUN_TOOL_EXPORT ~Regex ();
  14. AFUN_TOOL_EXPORT int match(const char *subject);
  15. };
  16. }
  17. #endif //AFUN_REGEX