[Issue 835] New: RegExp.test wrongly matches strings on case insensitive attribute

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 12 20:20:56 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=835

           Summary: RegExp.test wrongly matches strings on case insensitive
                    attribute
           Product: D
           Version: 1.00
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P3
         Component: Phobos
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: tom_dlang at yahoo.com.ar


The following code describes the problem. I've noted also that [] in the regexp
is determinant for the bug to show.

------------------------------------------------------------------

import std.regexp;
import std.stdio;

int main() {
  auto str= "foo";
  auto regex_str= r"fo[o]x";

  auto regex= new RegExp(regex_str);
  auto regex_i= new RegExp(regex_str, "i");

  writefln("'%s' matches '%s' ? ", str, regex_str, 
      cast(bool) regex.test(str)); 

  writefln("'%s' matches case insensitive '%s' ? ", str, regex_str, 
      cast(bool) regex_i.test(str));

  return 0;
}

-------------------------------------------------------------------

The output is:

D:\src\d_tests>dmd -run bug_regexp.d
'foo' matches 'fo[o]x' ? false
'foo' matches case insensitive 'fo[o]x' ? true

Regards,
--
Tom;


-- 



More information about the Digitalmars-d-bugs mailing list