835 – RegExp.test wrongly matches strings on case insensitive attribute

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 835 - RegExp.test wrongly matches strings on case insensitive attribute
Summary: RegExp.test wrongly matches strings on case insensitive attribute
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P3 major
Assignee: Walter Bright
URL:
Keywords:
Depends on:
Blocks:
Reported: 2007年01月12日 22:20 UTC by Tom
Modified: 2014年02月15日 13:12 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Tom 2007年01月12日 22:20:53 UTC
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;
Comment 1 Tom 2007年02月08日 09:17:06 UTC
Seems fixed in dmd 1.005.
Comment 2 Walter Bright 2007年02月12日 03:39:01 UTC
Fixed DMD 1.005


AltStyle によって変換されたページ (->オリジナル) /