Regular expression match returns same object on successive matches
------------------------------------------------------------------
Key: JRUBY-1385
URL: http://jira.codehaus.org/browse/JRUBY-1385
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.x
Environment: OSX 10.4.10, JRuby head from source (4382)
Reporter: David Koontz
When using String#match, invalid match data is returned. Specifically, the
previous match object is returned for a new string match. Also, this is a
regression, I tested it under a build from 3 weeks ago and it was working
properly.
pattern = /\w/
["foo", "bar"].each {|e| p pattern.match(e)}
["foo", "bar"].each {|e| p e.match(pattern)}
Ruby output:
#<MatchData:0x25120>
#<MatchData:0x250e4>
#<MatchData:0x25080>
#<MatchData:0x25058>
JRuby output:
#<MatchData:0x754a4a>
#<MatchData:0xed35e0>
#<MatchData:0xd1c812>
#<MatchData:0xd1c812>
As you can see, when using the String's match method, for both the "foo" and
"bar" strings yields the exact same object.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email