浏览该文件的文档.
108 Ex(
const Ex &) =
delete;
112 std::unique_ptr<Private>
p;
137 size_t m_len = std::string::npos;
138 const std::string *
m_str =
nullptr;
190 void init(
const std::string *
str)
216 void setMatch(
size_t pos,
size_t len)
223 const std::string *
m_str =
nullptr;
244 Iterator(
const std::string &str,
const Ex &re,
size_t pos=0)
250 Iterator(
const std::string &str,
Ex &&re) =
delete;
251 Iterator(std::string &&str,
Ex &&re) =
delete;
278 m_pos=std::string::npos;
281 const std::string *
m_str =
nullptr;
283 size_t m_pos = std::string::npos;
316 bool search(
const std::string &str,
const Ex &re,
size_t pos=0);
327 bool match(
const std::string &str,
const Ex &re);
332 std::string
replace(
const std::string &str,
const Ex &re,
const std::string &replacement);
void setMatch(size_t pos, size_t len)
const SubMatch & operator[](size_t index) const
Returns the n-th SubMatch object.
std::string str() const
Returns the matching part as a string
std::string str() const
Return a string representing the matching part.
~Ex()
Destroys the regular expression object.
std::string replace(const std::string &str, const Ex &re, const std::string &replacement)
Searching in a given input string for parts that match regular expression re and replaces those parts...
bool operator!=(const Iterator &rhs) const
Returns true if the iterators are not pointing to the same match
SubMatch prefix() const
Return the part of the string before the match
void setStart(size_t pos)
bool match(const std::string &str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
size_t length() const
Returns the length of the matching part.
void endCapture(size_t index)
size_t length() const
Returns the position of the match or std::string::npos if no length is set.
@ Wildcard
simple globbing pattern.
void setMatch(size_t pos, size_t len)
bool operator==(const Iterator &rhs) const
Returns true if the iterators point to the same match (or both are end-of-sequence iterators)
Match()
Creates an empty match object
void init(const std::string *str)
const std::string * m_str
Iterator class to iterator through matches.
Namespace for the regular expression functions
void startCapture(size_t index)
size_t position() const
Returns the position in the string at which the match starts.
Object representing the match results of a capture range.
bool match(const std::string &str, Match &match, size_t pos=0) const
Check if a given string matches this regular expression.
Iterator & operator++()
Advances the iterator to the next match.
Iterator()
Creates an end-of-sequence iterator
size_t position() const
Returns the position of the match or std::string::npos if no position is set.
Object representing the matching results.
std::ptrdiff_t difference_type
const std::string * m_str
std::forward_iterator_tag iterator_category
SubMatch(const std::string *str)
Creates a match for a single capture range given a non-owning pointer to the string.
std::vector< SubMatch > m_subMatches
const value_type & operator*() const
Returns a reference to the current match
size_t size() const
Returns the number of sub matches available in this match.
Class representing a regular expression.
SubMatch suffix() const
Return the part of the string after the match
@ RegEx
full regular expression.
Ex(const std::string &pattern, Mode mode=Mode::RegEx)
Creates a regular expression object given the pattern as a string.
bool search(const std::string &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.
const value_type * operator->() const
Returns a pointer to the current match
Private members of a regular expression
const std::string * m_str
Ex & operator=(const Ex &e)=delete
std::unique_ptr< Private > p