Project

General

Profile

Actions

Bug #3681

closed

Character class abbreviations, + repetition notation and group backreferences issue in Regexp

Added by dre3k (Andrei Kulakov) over 13 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.3dev (2010-08-17 trunk 29020) [x86_64-freebsd8.1]
Backport:
[ruby-core:31677]

Description

=begin
There seems to be a bug in Ruby 1.9.2 rc2 regarding Regular Expression

/([A-Z][a-z]+){2}/ =~ 'TestString' # => 0 #correct
/([A-Z]\w+){2}/ =~ 'TestString' # => nil #should be 0
/(A-Z+){2}/ =~ 'TestString' # => 0 #correct
/(A-Z+){2}/ =~ 'TestString' # => nil #should be 0
/([A-Z]\w{1,10}){2}/ =~ 'TestString' # => 0 #correct
/([A-Z]\w{1,}){2}/ =~ 'TestString' # => nil #should be 0

Ruby 1.9.1 p429 yields correct result

/([A-Z][a-z]+){2}/ =~ 'TestString' # => 0 #correct
/([A-Z]\w+){2}/ =~ 'TestString' # => 0 #correct
/(A-Z+){2}/ =~ 'TestString' # => 0 #correct
/(A-Z+){2}/ =~ 'TestString' # => 0 #correct
/([A-Z]\w{1,10}){2}/ =~ 'TestString' # => 0 #correct
/([A-Z]\w{1,}){2}/ =~ 'TestString' # => 0 #correct
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0