From: Adam Carheden <redmine@...>
Date: 2009-06-20T00:52:40+09:00
Subject: [ruby-core:23934] [Bug #1661] RegExp mismatch

Bug #1661: RegExp mismatch
http://redmine.ruby-lang.org/issues/show/1661

Author: Adam Carheden
Status: Open, Priority: Normal
ruby -v: 1.8.6, patchlevel 369, i686-linux (Gentoo dev-lang/ruby-1.8.6_p369 ebuild)

#---------------------------
if matches = "all   ".match(Regexp.new("^((all)|(submit)|(view))\s\s*",Regexp::EXTENDED|Regexp::IGNORECASE))
	print "Match\n#{matches.to_a.join("\n\t")}"
else
	print "no match\n"
end
#---------------------------
prints "Match...", but 
#---------------------------
if matches = "all   1".match(Regexp.new("^((all)|(submit)|(view))\s\s*1",Regexp::EXTENDED|Regexp::IGNORECASE))
	print "Match\n#{matches.to_a.join("\n\t")}"
else
	print "no match\n"
end
#---------------------------
prints "no match". Note that the differences is the addition of a '1' to the end of both the regular expression and the string. The same thing happens if I add '\d' instead of 1.


I know I'm using an old version. Possibly it's already fixed. Also, I didn't search for existing bugs because I couldn't figure out how to search by keyword on redmine.ruby-lang.org. Sorry if this is a dup.


----------------------------------------
http://redmine.ruby-lang.org