From: James Sanders Date: 2008-05-06T10:42:26+09:00 Subject: Possible regular expression Ruby's regular expression engine appears to act incorrectly when given a non-greedy match-range of the form {m,n}? Take this example: "Age: 21" =~ /Age.{0,60}: ([\w]+)/ This returns 0, as expected and $1 is set to "21" However: "Age: 21" =~ /Age.{0,60}?: ([\w]+)/ This returns nil and $1 is set to nil. I believe the greedy and non-greedy cases should be equivalent in this case, but are not. I've included a tarball with two files, one written in perl and the other in ruby, performing this match. The perl script acts as expected. Apologies if this is a known bug that I have been unable to find on RubyForge, or if this is expected behavior. If it is the former I would appreciate anyone who could point me at the bug listing, and if it is the latter, I would appreciate enlightenment on the reason for this behavior. In any other case, it would be much appreciated for anyone to verify that this behavior is a bug, and I will file it. Thanks Attachments: http://www.ruby-forum.com/attachment/1854/re.tar -- Posted via http://www.ruby-forum.com/.