Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stl/inc/regex
Original file line number Diff line number Diff line change
Expand Up @@ -3521,7 +3521,7 @@ bool _Matcher<_BidIt, _Elem, _RxTraits, _It>::_Is_wbound() const {
}
} else { // --_Cur is not valid
if (_Tgt_state._Cur == _End) {
return (_Mflags & (regex_constants::match_not_bow | regex_constants::match_not_eow)) == 0;
return false;
} else {
return (_Mflags & regex_constants::match_not_bow) == 0 && _Is_word(*_Tgt_state._Cur);
}
Expand Down
9 changes: 8 additions & 1 deletion tests/std/tests/VSO_0000000_regex_use/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ void test_VSO_225160_match_eol_flag() {

void test_VSO_226914_word_boundaries() {
const test_regex emptyAnchor(&g_regexTester, R"(\b)");
emptyAnchor.should_search_match("", "");
emptyAnchor.should_search_fail("");
emptyAnchor.should_search_fail("", match_not_bow);
emptyAnchor.should_search_fail("", match_not_eow);
emptyAnchor.should_search_fail("", match_not_bow | match_not_eow);
Expand Down Expand Up @@ -1434,6 +1434,12 @@ void test_gh_5364() {
g_regexTester.should_match("c", "[^]", ECMAScript);
}

void test_gh_5371() {
// GH-5371 <regex>: \b and \B are backwards on empty strings
g_regexTester.should_not_match("", R"(\b)");
g_regexTester.should_match("", R"(\B)");
}

int main() {
test_dev10_449367_case_insensitivity_should_work();
test_dev11_462743_regex_collate_should_not_disable_regex_icase();
Expand Down Expand Up @@ -1474,6 +1480,7 @@ int main() {
test_gh_5253();
test_gh_5362();
test_gh_5364();
test_gh_5371();

return g_regexTester.result();
}