123456789101112131415161718192021222324 |
- #ifndef AFUN_TOOL_REGEX
- #define AFUN_TOOL_REGEX
- #define PCRE2_CODE_UNIT_WIDTH 8
- #include "pcre2.h"
- namespace aFuntool {
- class AFUN_TOOL_EXPORT Regex { // 整个对象都是inline的, 不需要Export符号
- pcre2_code *re; // 正则表达式
- std::string pattern; // 正则表达式的字符串
- public:
- explicit Regex(std::string pattern_) noexcept(false);
- inline Regex(const Regex ®ex) noexcept;
- inline Regex(Regex &®ex) noexcept;
- inline ~Regex() noexcept;
- Regex &operator=(const Regex ®ex)=delete;
- Regex &operator=(Regex &®ex)=delete;
- [[nodiscard]] bool match(const std::string &subject) const;
- };
- }
- #include "tool-regex.inline.h"
- #endif //AFUN_TOOL_REGEX
|