boostorg / boostorg/locale

Boost.locale makes std::regex not match anything

Open
#249 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
40
Forks
76
PR merge metrics
No merged PRs in 30d

Description

I had initially posted a comment in #35, but maybe it deserves its own issue instead.
I think it's essentially the same problem, except I'm on macOS 13,
```bash
$ clang++ -v
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: x86_64-apple-darwin22.6.0.
```

I'm using boost 1.86.0, built against ICU 74.2

I had seen this behavior before, and have never found a real solution. I now stumbled upon it again on a project. I spent about two days trying to tune my regex, thinking I must have made a mistake. Eventually I began simplifying it and simplifying it, without it resolving.

Eventually, I decided to make a minimal example to test it; so I have following code:

```c++
#include
#include
#include
#include
#include

int main() {
boost::locale::generator locGen;
const std::locale loc = locGen("en_US.UTF-8");
// std::locale::global(loc);
auto pattern = std::regex(R"(^(?:\s)*([_[:alnum:].-]+)\s*=\s*([^;#\n\r]+)*)");
// pattern.imbue(loc);
const std::string text{" pozo = mani"};
std::smatch result;
std::regex_search(text, result, pattern);
std::cout << "ready: " << result.ready() << ", size: " << result.size() << std::endl;
for (size_t i=0; i < result.size(); i++) {
std::cout << "match[" <
#include
#include
#include
#include

int main() {
boost::locale::generator locGen;
const std::locale loc = locGen("en_US.UTF-8");
std::locale testLoc = std::locale(std::locale::classic(), loc, std::locale::collate);
std::locale::global(testLoc);
auto pattern = std::regex(R"(^(?:\s)*([_[:alnum:].-]+)\s*=\s*([^;#\n\r]+)*)");
// pattern.imbue();
const std::string text{" pozo = mani"};
std::smatch result;
std::regex_search(text, result, pattern);
std::cout << "ready: " << result.ready() << ", size: " << result.size() << std::endl;
for (size_t i=0; i < result.size(); i++) {
std::cout << "match[" <

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.