Go to the documentation of this file.
32 return NullObjectRef<wordRes>();
36 inline bool Foam::wordRes::found_match
39 const std::string& text,
43 for (
const wordRe& select : patterns)
45 if (select.match(text, literal))
57 const UList<wordRe>& patterns,
58 const std::string& text
61 auto retval(wordRe::compOption::UNKNOWN);
63 for (
const wordRe& select : patterns)
65 if (select.isLiteral())
67 if (select.match(text,
true))
69 return wordRe::compOption::LITERAL;
72 else if (wordRe::compOption::UNKNOWN == retval)
74 if (select.match(text,
false))
76 retval = wordRe::compOption::REGEX;
89 return found_match(*
this, text, literal);
96 return found_matched(*
this, text);
100 template<
class StringType>
107 const label len = input.
size();
112 for (label i=0; i < len; ++i)
130 return found_match(*
this, text);
labelList matching(const UList< StringType > &input, const bool invert=false) const
Extract list indices for all matches.
wordRe::compOption matched(const std::string &text) const
Smart match in the list of matchers, returning the match type.
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
bool match(const std::string &text, bool literal=false) const
Smart match as literal or regex, stopping on the first match.
bool operator()(const std::string &text) const
Identical to match(), for use as a predicate.
void resize(const label newSize)
Adjust allocated size of list.
bool match(const UList< wordRe > &patterns, const std::string &text)
Return true if text matches one of the regular expressions.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
A List of wordRe with additional matching capabilities.
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
static const wordRes & null()
Return a null wordRes - a reference to the NullObject.
compOption
Enumeration with compile options.