www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14529] New: Bug in Regex insensitive match

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 puremagic.com
          Reporter: kasamia.o.kasatua 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.

--
Apr 29 2015