Manipulating Match Results
Match results from the RWURegularExpression methods search() and matchAt() are returned as RWURegexResult objects. These instances can be used later to obtain details concerning the regular expression match.
For example, this class contains a conversion to bool, which indicates whether the search() or matchAt() operation found a match. Thus:
 
RWURegularExpression r(pattern);
RWURegexResult result = r.search(str);
 
if (result) {
// Do something here
}
You can obtain standard iterators to the beginning and ending of the overall match, or of a subexpression match, from an RWURegexResult using the begin() and end() methods, respectively. You can also use the provided getStart() and getLength() methods to find the extent of a match. For example:
 
RWURegularExpression r(pattern);
 
if (r.search(str)) {
std::cout << "Match at offset: " << result.getStart() << "\n"
<< "Match length: " << result.getLength()
<< std::endl;
}
The provided subString() method returns the substring for a match as an immutable RWUConstSubString.