Project

General

Profile

Actions

Bug #3397

closed

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

Added by papaya (Tony Hsu) almost 14 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
r28169
[ruby-core:30613]

Description

=begin
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

Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 14 years ago

  • Category set to core
  • Priority changed from 5 to Normal
  • Target version set to Ruby 1.8.8
  • ruby -v set to r28169

=begin

=end

Actions #2

Updated by shyouhei (Shyouhei Urabe) almost 14 years ago

=begin
Seems like a real bug to me.

zsh % ~/target/ruby_1_9_2/bin/ruby -ve 'puts(/wo{0,3}?/.match("woo"))'
ruby 1.9.2dev (2010-06-06 revision 28186) [x86_64-linux]
w
zsh % ~/target/ruby_1_8/bin/ruby -ve 'puts(/wo{0,3}?/.match("woo"))'
ruby 1.8.8dev (2010-06-05 revision 27061) [x86_64-linux]
wo

=end

Actions #3

Updated by naruse (Yui NARUSE) almost 14 years ago

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

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

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0