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);
234 regexPtr_.swap(str.regexPtr_);
260 regexPtr_.reset(
nullptr);
268 regexPtr_.reset(
nullptr);
static bool is_meta(const char c) noexcept
Test if character is a regex meta-character.
void swap(wordRe &str)
Swap contents. Self-swapping is a no-op.
compOption
Enumeration with compile options.
bool match(const UList< wordRe > &selectors, const std::string &text)
True if text matches one of the selector expressions.
bool compile()
Compile as regular expression (if possible)
Ignore case in regular expression.
bool operator()(const std::string &text) const
Perform smart match on text, as per match()
void operator=(const wordRe &str)
Copy assignment, retaining type (literal or regex)
A class for handling words, derived from Foam::string.
wordRe()
Default construct, empty literal.
static int debug
Debugging.
bool isLiteral() const noexcept
The wordRe is a literal string, not a pattern.
static bool valid(char c)
Is this character valid for a word?
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings...
void clear()
Clear string and regular expression.
static bool valid(const char c)
Test for valid wordRe character?
void assign(Field< Tout > &result, const Field< T1 > &a, const UnaryOp &op)
Populate a field as the result of a unary operation on an input.
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.
const dimensionedScalar c
Speed of light in a vacuum.
void set(const std::string &str, const compOption opt=DETECT)
Copy string, auto-test for regular expression or other options.
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(std::string &str)
Swap contents. Self-swapping is a no-op.
bool isPattern() const noexcept
The wordRe is a pattern, not a literal string.
Detect if the string contains meta-characters.