60 word(std::move(static_cast<
word&>(str))),
61 regexPtr_(str.regexPtr_.release())
107 return !
bool(regexPtr_);
113 return bool(regexPtr_);
146 regexPtr_.reset(
nullptr);
149 return bool(regexPtr_);
154 regexPtr_.reset(
nullptr);
166 if (!regexPtr_->set(*
this))
169 regexPtr_.reset(
nullptr);
172 return bool(regexPtr_);
178 regexPtr_.reset(
nullptr);
187 string::stripInvalid<word>(*
this);
189 regexPtr_.reset(
nullptr);
196 regexPtr_.reset(
nullptr);
202 if (!literal && regexPtr_)
204 return regexPtr_->match(text);
207 return !compare(text);
233 word::swap(
static_cast<word&
>(str));
234 regexPtr_.swap(str.regexPtr_);
260 regexPtr_.reset(
nullptr);
268 regexPtr_.reset(
nullptr);
bool valid() const
True if all internal ids are non-negative.
Ostream & operator()() const
Output stream (master only).
Wrapper around C++11 regular expressions with some additional prefix-handling. The prefix-handling is...
static bool is_meta(const char c) noexcept
Test if character is a regex meta-character.
bool set() const
Are all the vector set.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
bool isLiteral() const noexcept
The wordRe is a literal string, not a pattern.
void operator=(const wordRe &str)
Copy assignment, retaining type (literal or regex)
bool compile()
Compile as regular expression (if possible)
wordRe()
Default construct, empty literal.
compOption
Enumeration with compile options.
@ DETECT
Detect if the string contains meta-characters.
@ REGEX
Regular expression.
@ ICASE
Ignore case in regular expression.
bool isPattern() const noexcept
The wordRe is a pattern, not a literal string.
void clear()
Clear string and regular expression.
void uncompile()
Mark as literal string, remove any regular expression.
bool match(const std::string &text, bool literal=false) const
Smart match as regular expression or as a string.
void swap(wordRe &str)
Swap contents. Self-swapping is a no-op.
A class for handling words, derived from Foam::string.
static int debug
Debugging.