Go to the documentation of this file.
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_);
Wrapper around POSIX extended regular expressions with some additional prefix-handling....
void swap(regExpPosix &rgx)
Swap contents.
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
bool search(const std::string &text) const
Return true if the regex was found within the text.
regExpPosix() noexcept
Default construct.
bool negated() const noexcept
True if pattern matching is negated.
bool negate(bool on) noexcept
Change pattern negation, return previous value.
void operator=(const regExpPosix &)=delete
Copy assignment - disallowed.
~regExpPosix()
Destructor.
bool operator()(const std::string &text) const
Perform match on text.
bool empty() const noexcept
Return true if a precompiled expression does not exist.
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Find index of the first occurrence that satisfies the predicate.
bool set(const char *pattern, bool ignoreCase=false)
Compile pattern into a regular expression, optionally ignore case.
bool match(const UList< wordRe > &patterns, const std::string &text)
Return true if text matches one of the regular expressions.
bool exists() const noexcept
Return true if a precompiled expression exists.