Issue 135009
Summary [libc++] `<regex>`: `\B` should not be found in `a+a`
Labels
Assignees
Reporter Alcaro
    ```c++
#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$`.

https://godbolt.org/z/69q9ehe4v
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to