58 set(pattern, ignoreCase);
64 const std::string& pattern,
71 set(pattern, ignoreCase);
99 return (ctrl_ == ctrlType::NEGATED);
105 bool old(ctrl_ == ctrlType::NEGATED);
111 ctrl_ = ctrlType::NEGATED;
116 ctrl_ = ctrlType::NORMAL;
125 return (preg_ && ctrl_ == ctrlType::NORMAL) ? preg_->re_nsub : 0;
135 (pattern ? std::char_traits<char>::length(pattern) : 0),
158 else if (text.empty())
160 return (ctrl_ == ctrlType::NEGATED);
163 return std::string::npos !=
find(text);
172 std::swap(preg_, rgx.preg_);
173 std::swap(ctrl_, rgx.ctrl_);
void swap(regExpPosix &rgx)
Swap contents.
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as ListOps::find_if.
bool match(const UList< wordRe > &patterns, const std::string &text)
Return true if text matches one of the regular expressions.
bool operator()(const std::string &text) const
Perform match on text.
bool empty() const noexcept
Return true if a precompiled expression does not exist.
regExpPosix() noexcept
Default construct.
bool negate(bool on) noexcept
Change pattern negation, return previous value.
~regExpPosix()
Destructor.
bool set(const char *pattern, bool ignoreCase=false)
Compile pattern into a regular expression, optionally ignore case.
unsigned ngroups() const
The number of capture groups for a non-empty, non-negated expressions.
bool exists() const noexcept
Return true if a precompiled expression exists.
Wrapper around POSIX extended regular expressions with some additional prefix-handling. The prefix-handling is loosely oriented on PCRE regular expressions and provides a simple means of tuning the expressions.
void operator=(const regExpPosix &)=delete
Copy assignment - disallowed.
bool negated() const noexcept
True if pattern matching is negated.
bool search(const std::string &text) const
Return true if the regex was found within the text.