1234567891011121314151617181920212223242526272829 |
- #ifndef AFUN_TOOL_REGEX_INLINE_H
- #define AFUN_TOOL_REGEX_INLINE_H
- #include "tool-regex.h"
- namespace aFuntool {
- inline Regex::Regex(const std::string &pattern_) noexcept(false) : re{pattern_}, pattern{pattern_} {
- if (!isCharUTF8(pattern))
- throw RegexException("Pattern not utf-8");
- }
- inline Regex::Regex(const Regex ®ex) noexcept: re{regex.pattern}, pattern{regex.pattern}{
- }
- inline Regex::Regex(Regex &®ex) noexcept : pattern {std::move(regex.pattern)}, re {std::move(regex.re)} {
- }
- inline bool Regex::match(const char *subject) const{
- return std::regex_match(subject, re);
- }
- inline bool Regex::match(const std::string &subject) const {
- return std::regex_match(subject, re);
- }
- }
- #endif //AFUN_TOOL_REGEX_INLINE_H
|