bug fix concerning search not at beginning of string and word boundaries

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@109750 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/regex b/include/regex
index efcc7df..51ba1ea 100644
--- a/include/regex
+++ b/include/regex
@@ -1907,7 +1907,8 @@
                               __traits_.isctype(__c, ctype_base::alnum);
             }
         }
-        else if (__s.__current_ == __s.__first_)
+        else if (__s.__current_ == __s.__first_ &&
+                !(__s.__flags_ & regex_constants::match_prev_avail))
         {
             if (!(__s.__flags_ & regex_constants::match_not_bow))
             {
@@ -5406,9 +5407,10 @@
     }
     if (__first != __last && !(__flags & regex_constants::match_continuous))
     {
-        __m.__matches_.assign(__m.size(), __m.__unmatched_);
+        __flags |= regex_constants::match_prev_avail;
         for (++__first; __first != __last; ++__first)
         {
+            __m.__matches_.assign(__m.size(), __m.__unmatched_);
             if (__match_at_start(__first, __last, __m, __flags))
             {
                 __m.__prefix_.second = __m[0].first;