-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!regexmeow is a substring of homeownermeow is a substring of homeowner
Description
Describe the bug
\b and \B are backwards on empty strings
Command-line test case
https://godbolt.org/z/9TnqKsvbe
#include <regex>
#include <stdio.h>
int main() {
try {
std::string s{""};
std::regex r{"\\b"};
std::smatch m;
bool result = std::regex_search(s, m, r);
printf("regex_search: %d\n", result);
for (unsigned i = 0; i < m.size(); ++i) {
printf("m[%d]", i);
if (m[i].matched) {
printf(".str(): \"%s\"\n", m[i].str().c_str());
} else {
puts(".matched: false");
}
}
} catch (const std::exception& e) {
printf("Exception: %s\n", e.what());
}
}
Expected behavior
Same as libstdc++, libc++ and Firefox: \B should match empty string, \b should not
STL version
Whatever's on Godbolt (I couldn't check if it's fixed on latest, but I did check for duplicate issues/PRs and found nothing)
Additional context
Yes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!regexmeow is a substring of homeownermeow is a substring of homeowner