[Issue 14529] New: Bug in Regex insensitive match

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Apr 29 21:41:51 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14529

          Issue ID: 14529
           Summary: Bug in Regex insensitive match
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: kasamia.o.kasatua at gmail.com

The following code describes the problem:

import std.stdio;
import std.regex;

void main() {
  auto ctr = ctRegex!(r"^[CF]$", "i");
  foreach(line; stdin.byLine) {
    foreach(m; line.matchAll(ctr)) {
      writeln("match: ", m.hit);
    }
  }
}

--

the simple regex should match: C, c, F, f
but only C, c, F will match.

and if you switch the order inside the char class: [FC]
only F, f, C are matched, but not c

It seems like there's something wrong with the last char that should match.
The same problem happens when using regex obj too.

--


More information about the Digitalmars-d-bugs mailing list