Project

General

Profile

Backport #3403

A bug related to ruby's regular expression!!!!!!

Added by naruse (Yui NARUSE) about 9 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal

Description

=begin
Backport r28192

I found a bug related to ruby's regular expression!
puts(/wo{0,3}?/.match("woo"))
This line of code should show a "w" on the screen, but my ruby shows "wo" on then screen.
According to the principles of regular expression, this is a non-greedy match, so it should match 0 "o", but it matches at least 1 "o". I think this is a bug!
I also tried this in the javascript language, it works well!("w" is shown)

My ruby version is v1.8.7-p249.
=end

Associated revisions

Revision 885527de
Added by wyhaines (Kirk Haines) about 9 years ago

regexp.c: Backport #3403; backported from r28192 to fix a bug with non-greedy matching.
test/ruby/test_regexp.rb: Backport #3403; added this test suite, commenting out inapplicable tests to the current 1.8.6.
ChangeLog: Got my date wrong in the last few entries. Tuesday is the 8th, not the 9th!

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@28231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

History

#1

Updated by naruse (Yui NARUSE) about 9 years ago

  • Assignee changed from shyouhei (Shyouhei Urabe) to wyhaines (Kirk Haines)

=begin

=end

#2

Updated by wyhaines (Kirk Haines) about 9 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r28231.
Yui, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Also available in: Atom PDF