www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:

           Summary: RegExp.test wrongly matches strings on case insensitive
           Product: D
           Version: 1.00
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P3
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: tom_dlang 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


Jan 12 2007
parent d-bugmail puremagic.com writes:

tom_dlang yahoo.com.ar changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

------- Comment #1 from tom_dlang yahoo.com.ar  2007-02-08 09:17 -------
Seems fixed in dmd 1.005.

Feb 08 2007