37 using Flag = std::regex_constants::syntax_option_type;
61 static constexpr Flag Awk = std::regex::awk;
112 return std::regex_match(str.
str(),
m, d);
121 return std::regex_search(str.
str(), d);
132 const std::string &
s = str.
str();
134 while(std::regex_search(pos,
s.
cend(),
match, d)) {
136 pos =
match.suffix().first;
Dynamic array container wrapping std::vector.
Definition list.h:40
ConstIterator cend() const noexcept
Returns a const iterator to one past the last element.
Definition list.h:208
ConstIterator cbegin() const noexcept
Returns a const iterator to the first element.
Definition list.h:168
Regular expression wrapper around std::regex.
Definition regex.h:34
std::regex_constants::syntax_option_type Flag
Syntax option flags for controlling regex behavior.
Definition regex.h:37
static constexpr Flag Awk
Use the awk POSIX regular expression grammar.
Definition regex.h:61
static constexpr Flag EGrep
Use the egrep (grep -E) POSIX regular expression grammar.
Definition regex.h:67
bool search(const String &str) const
Searches for the first occurrence of the pattern within the string.
Definition regex.h:120
static constexpr Flag ECMAScript
Use the Modified ECMAScript regular expression grammar.
Definition regex.h:52
RegEx(const char *pattern, Flag flags=DefaultFlags)
Constructs a RegEx from a C string pattern.
Definition regex.h:84
static constexpr Flag Extended
Use the extended POSIX regular expression grammar.
Definition regex.h:58
String pattern() const
Returns the current pattern string.
Definition regex.h:101
bool match(const String &str) const
Tests whether the entire string matches the pattern.
Definition regex.h:110
static constexpr Flag IgnoreCase
Case-insensitive matching.
Definition regex.h:40
RegEx & operator=(const String &pattern)
Assigns a new pattern to this regex.
Definition regex.h:91
StringList matches(const String &str) const
Returns all non-overlapping matches of the pattern in the string.
Definition regex.h:129
RegEx(const String &pattern, Flag flags=DefaultFlags)
Constructs a RegEx from a String pattern.
Definition regex.h:77
static constexpr Flag Optimize
Optimize the regex for faster matching at the cost of slower construction.
Definition regex.h:46
static constexpr Flag Collate
Make character ranges like "[a-b]" locale sensitive.
Definition regex.h:49
static constexpr Flag Basic
Use the basic POSIX regular expression grammar.
Definition regex.h:55
static constexpr Flag NoSubs
Treat all sub-expressions as non-marking; no matches are stored.
Definition regex.h:43
static constexpr Flag Grep
Use the grep POSIX regular expression grammar.
Definition regex.h:64
static constexpr Flag DefaultFlags
Default flags: ECMAScript grammar with optimization enabled.
Definition regex.h:70
Manages a list of strings.
Definition stringlist.h:21
Encoding-aware string class with copy-on-write semantics.
Definition string.h:35
const char * cstr() const
Returns a null-terminated C string pointer.
Definition string.h:289
const std::string & str() const
Returns a const reference to the underlying std::string.
Definition string.h:286
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19