regex.h 638 B

123456789101112131415161718192021222324252627
  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 AFUN_TOOL_EXPORT Regex {
  9. pcre2_code *re; // 正则表达式
  10. const std::string pattern; // 正则表达式的字符串
  11. public:
  12. explicit Regex(const std::string &pattern_);
  13. Regex(const Regex &regex);
  14. Regex &operator=(const Regex &regex);
  15. ~Regex ();
  16. int match(const char *subject);
  17. int match(const std::string &subject);
  18. };
  19. }
  20. #include "regex.inline.h"
  21. #endif //AFUN_REGEX