114 std::unique_ptr<Private>
p;
280 m_pos=std::string::npos;
318bool search(std::string_view str,
const Ex &re,
size_t pos=0);
329bool match(std::string_view str,
const Ex &re);
334std::string
replace(std::string_view str,
const Ex &re,std::string_view replacement);
Private members of a regular expression.
Class representing a regular expression.
~Ex()
Destroys the regular expression object.
std::unique_ptr< Private > p
bool match(std::string_view str, Match &match, size_t pos=0) const
Check if a given string matches this regular expression.
Ex(std::string_view pattern, Mode mode=Mode::RegEx)
Creates a regular expression object given the pattern as a string.
@ RegEx
full regular expression.
@ Wildcard
simple globbing pattern.
Iterator(std::string &&str, const Ex &re)=delete
const value_type & operator*() const
Returns a reference to the current match.
Iterator(std::string &&str, Ex &&re)=delete
Iterator & operator++()
Advances the iterator to the next match.
Iterator(const std::string &str, Ex &&re)=delete
std::forward_iterator_tag iterator_category
std::ptrdiff_t difference_type
Iterator()
Creates an end-of-sequence iterator.
const value_type * operator->() const
Returns a pointer to the current match.
Iterator(std::string_view str, const Ex &re, size_t pos=0)
Creates an iterator for input string str, using regular expression re to search.
bool operator==(const Iterator &rhs) const
Returns true if the iterators point to the same match (or both are end-of-sequence iterators)
bool operator!=(const Iterator &rhs) const
Returns true if the iterators are not pointing to the same match.
Object representing the matching results.
Match()
Creates an empty match object.
const SubMatch & operator[](size_t index) const
Returns the n-th SubMatch object.
void startCapture(size_t index)
size_t size() const
Returns the number of sub matches available in this match.
void endCapture(size_t index)
SubMatch prefix() const
Return the part of the string before the match.
size_t position() const
Returns the position of the match or std::string::npos if no position is set.
std::string str() const
Return a string representing the matching part.
void init(std::string_view str)
std::vector< SubMatch > m_subMatches
void setMatch(size_t pos, size_t len)
SubMatch suffix() const
Return the part of the string after the match.
size_t length() const
Returns the position of the match or std::string::npos if no length is set.
Object representing the match results of a capture range.
size_t length() const
Returns the length of the matching part.
void setStart(size_t pos)
void setMatch(size_t pos, size_t len)
SubMatch(std::string_view str)
Creates a match for a single capture range given a non-owning pointer to the string.
size_t position() const
Returns the position in the string at which the match starts.
std::string str() const
Returns the matching part as a string.
#define NON_COPYABLE(cls)
Macro to help implementing the rule of 5 for a non-copyable & movable class.
Namespace for the regular expression functions.
bool search(std::string_view str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
std::string replace(std::string_view str, const Ex &re, std::string_view replacement)
Searching in a given input string for parts that match regular expression re and replaces those parts...
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.