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);
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.
static bool valid(const std::string &str)
Does the string contain valid characters only?
static bool stripInvalid(std::string &str)
Strip invalid characters from the given string.
void swap(std::string &str)
Swap contents. Self-swapping is a no-op.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
bool assign(const token &tok)
Assign from word or string token.
void set(const std::string &str, const compOption opt=DETECT)
Copy string, auto-test for regular expression or other options.
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).
static bool valid(const char c)
Test for valid wordRe character?
bool compile()
Compile as regular expression (if possible).
bool operator()(const std::string &text) const
Perform smart match on text, as per match().
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.
word()=default
Default construct.
static bool valid(char c)
Is this character valid for a word?
static int debug
Debugging.
regExpCxx regExp
Selection of preferred regular expression implementation.