Open
Description
#include <regex>
#include <stdio.h>
int main() {
try {
const char * s{"a+a"};
std::regex r{"\\B"};
std::cmatch 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(" = %d %d", (int)(m[i].first-s), (int)(m[i].second-s));
} else {
puts(".matched: false");
}
}
} catch (const std::exception& e) {
printf("Exception: %s\n", e.what());
}
}
Expected: No match; all four positions in that string should be boundary.
Actual: libc++ thinks end of string is a non-boundary. It also returns match if searching for \b$
.