https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77492

            Bug ID: 77492
           Summary: std regex icase doesn't seem to work correctly.
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: flashmozzg at gmail dot com
  Target Milestone: ---

It seems that the case is not ignored in this example code (should count the
number of pairs of equal words ignoring case):

int test(std::string letter) {
  std::regex re ("([^a-z]|^)([a-z]+)[^a-z]+\\2([^a-z]|$)",
std::regex_constants::icase);

  return std::distance(
    std::sregex_iterator(letter.begin(), letter.end(), re),
    std::sregex_iterator()
  );
}

int main() {
        cout << test("Test test");
        return 0;
}

It prints 0, while test("test test") outputs 1.

Reply via email to