-// Count the number of subexpressions (taken from wxRegExImpl::Compile)
-//
-size_t RegExTestCase::matchCount(const wxString& expr, int flags)
-{
- // there is always one for the whole expression
- size_t nMatches = 1;
-
- // and some more for bracketed subexperessions
- for ( const wxChar *cptr = expr; *cptr; cptr++ )
- {
- if ( *cptr == _T('\\') )
- {
- // in basic RE syntax groups are inside \(...\)
- if ( *++cptr == _T('(') && (flags & wxRE_BASIC) )
- {
- nMatches++;
- }
- }
- else if ( *cptr == _T('(') && !(flags & wxRE_BASIC) )
- {
- // we know that the previous character is not an unquoted
- // backslash because it would have been eaten above, so we
- // have a bar '(' and this indicates a group start for the
- // extended syntax
- nMatches++;
- }
- }
-
- return nMatches;
-}
-