diff --git a/introduction.htm b/introduction.htm index 262201d5..875a32da 100644 --- a/introduction.htm +++ b/introduction.htm @@ -158,12 +158,14 @@ result of a match contains a number of sub-expression matches in addition to the overall match. When the library needs to report a regular expression match it does so using an instance of the class match_results, -as before there are typedefs of this class for the two most -common cases:

+as before there are typedefs of this class for the most common +cases:

namespace boost{
 typedef match_results<const char*> cmatch;
 typedef match_results<const wchar_t*> wcmatch;
+typedef match_results<std::string::const_iterator> smatch;
+typedef match_results<std::wstring::const_iterator> wsmatch; 
 }

The algorithms regex_search diff --git a/template_class_ref.htm b/template_class_ref.htm index 0788cf5c..6b4985fb 100644 --- a/template_class_ref.htm +++ b/template_class_ref.htm @@ -871,7 +871,9 @@ each sub-expression match being contained in an object of type sub_match.    bool operator<(const match_results& that)const; }; typedef match_results<const char*> cmatch; -typedef match_results<const wchar_t*> wcmatch; +typedef match_results<const wchar_t*> wcmatch; +typedef match_results<std::string::const_iterator> smatch; +typedef match_results<std::wstring::const_iterator> wsmatch;

Class match_results is used for reporting what matched a regular expression, it is passed to the matching algorithms

The algorithm regex _match determines whether a given regular expression matches a given sequence denoted by a pair of -bidirectional-iterators, the algorithm is defined as follows, -note that the result is true only if the expression matches the -whole of the input sequence, the main use of this function is -data input validation:

+bidirectional-iterators, the algorithm is defined as follows, note +that the result is true only if the expression matches the whole +of the input sequence, the main use of this function is data +input validation:

template <class iterator, class Allocator, class charT, class traits, class Allocator2>
 bool regex_match(iterator first, 
@@ -1205,7 +1207,12 @@ return true or false and do not indicate what matched: 

will be less than or equal to last. m[1] denotes the first subexpression m[2] the second subexpression and so on. If no match occurred then m[0].first = m[0].second = - last. + last.

Note that since the match_results structure + stores only iterators, and not strings, the iterators/strings + passed to regex_match must be valid for as long as the + result is to be used. For that reason never pass + temporary string objects to regex_match.

+   @@ -1456,7 +1463,13 @@ upon your compilers capabilities]:

that matched, m[0].first and m[0].second will be less than or equal to last. m[1] denotes the first sub-expression m[2] the second sub-expression and so on. If no match - occurred then m[0].first = m[0].second = last. + occurred then m[0].first = m[0].second = last.

Note + that since the match_results structure stores only + iterators, and not strings, the iterators/strings passed + to regex_search must be valid for as long as the result + is to be used. For that reason never pass temporary + string objects to regex_search.

+