Go to the documentation of this file.
60 word(std::move(static_cast<
word&>(str))),
61 re_(std::move(str.re_))
103 return !re_.exists();
146 return re_.set(*
this);
161 string::stripInvalid<word>(*
this);
176 if (!literal && re_.exists())
178 return re_.match(text);
181 return !compare(text);
bool isPattern() const noexcept
The wordRe is treated as a pattern, not as literal string.
A class for handling words, derived from Foam::string.
void operator=(const wordRe &str)
Copy assignment, retaining type (literal or regex)
Detect if the string contains meta-characters.
bool isLiteral() const noexcept
The wordRe is treated as literal string, not as pattern.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
bool compile()
Compile as regular expression.
wordRe()
Default construct, empty literal.
static bool valid(const char c)
Test for valid wordRe character?
static bool valid(char c)
Is this character valid for a word?
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.
Ignore case in regular expression.
static int debug
Debugging.
void clear()
Clear string and regular expression.
bool match(const UList< wordRe > &patterns, const std::string &text)
Return true if text matches one of the regular expressions.
const dimensionedScalar c
Speed of light in a vacuum.
void swap(std::string &str)
Swap contents. Self-swapping is a no-op.
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.
static bool is_meta(const char c) noexcept
Test if character is a regex meta-character.
bool operator()(const std::string &text) const
Perform smart match on text, as per match()
bool match(const std::string &text, bool literal=false) const
Smart match as regular expression or as a string.
compOption
Enumeration with compile options.
void swap(wordRe &str)
Swap contents. Self-swapping is a no-op.