ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:55627] [ruby-trunk - Bug #8565][Open] Compiled Regexp comparation bug
@ 2013-06-24  7:32 pyromaniac (Arkady Zabazhanov)
  2013-06-24  7:40 ` [ruby-core:55628] [ruby-trunk - Bug #8565] " charliesome (Charlie Somerville)
  2013-06-27 20:36 ` [ruby-core:55675] " cedric.brancourt (Cedric Brancourt)
  0 siblings, 2 replies; 3+ messages in thread
From: pyromaniac (Arkady Zabazhanov) @ 2013-06-24  7:32 UTC (permalink / raw
  To: ruby-core


Issue #8565 has been reported by pyromaniac (Arkady Zabazhanov).

----------------------------------------
Bug #8565: Compiled Regexp comparation bug
https://bugs.ruby-lang.org/issues/8565

Author: pyromaniac (Arkady Zabazhanov)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.4.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


2.0.0p195 :001 > Regexp.new('\/') == /\//
 => false

There is no such problem in latest 1.9.3, expression return true


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:55628] [ruby-trunk - Bug #8565] Compiled Regexp comparation bug
  2013-06-24  7:32 [ruby-core:55627] [ruby-trunk - Bug #8565][Open] Compiled Regexp comparation bug pyromaniac (Arkady Zabazhanov)
@ 2013-06-24  7:40 ` charliesome (Charlie Somerville)
  2013-06-27 20:36 ` [ruby-core:55675] " cedric.brancourt (Cedric Brancourt)
  1 sibling, 0 replies; 3+ messages in thread
From: charliesome (Charlie Somerville) @ 2013-06-24  7:40 UTC (permalink / raw
  To: ruby-core


Issue #8565 has been updated by charliesome (Charlie Somerville).


I took a quick look at why this is happening. The equality fails because the source of the two regexps is different:

1.9.3:

>> Regexp.new('\/').source
=> "\\/"
>> /\//.source
=> "\\/"

2.0.0:

>> Regexp.new('\/').source
=> "\\/"
>> /\//.source
=> "/"
----------------------------------------
Bug #8565: Compiled Regexp comparation bug
https://bugs.ruby-lang.org/issues/8565#change-40115

Author: pyromaniac (Arkadiy Zabazhanov)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.4.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


2.0.0p195 :001 > Regexp.new('\/') == /\//
 => false

There is no such problem in latest 1.9.3, expression return true


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:55675] [ruby-trunk - Bug #8565] Compiled Regexp comparation bug
  2013-06-24  7:32 [ruby-core:55627] [ruby-trunk - Bug #8565][Open] Compiled Regexp comparation bug pyromaniac (Arkady Zabazhanov)
  2013-06-24  7:40 ` [ruby-core:55628] [ruby-trunk - Bug #8565] " charliesome (Charlie Somerville)
@ 2013-06-27 20:36 ` cedric.brancourt (Cedric Brancourt)
  1 sibling, 0 replies; 3+ messages in thread
From: cedric.brancourt (Cedric Brancourt) @ 2013-06-27 20:36 UTC (permalink / raw
  To: ruby-core


Issue #8565 has been updated by cedric.brancourt (Cedric Brancourt).


Hopefully this is not a bug (or I think it is not).

When you create new regexp with :
%r"\/" and Regexp.new("\/") your quote are the delimiters

when you create regexp with slashes /\// the slashes (/) are your delimiters. Your regexp should end at the second / but fortunately you can escape this one with a backslash.
So your backslash is there used to escape the second one. This mean that your regexp /\// is equal to %r"/"

[6] pry(main)> /\// == %r"/"
=> true



----------------------------------------
Bug #8565: Compiled Regexp comparation bug
https://bugs.ruby-lang.org/issues/8565#change-40180

Author: pyromaniac (Arkadiy Zabazhanov)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.4.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


2.0.0p195 :001 > Regexp.new('\/') == /\//
 => false

There is no such problem in latest 1.9.3, expression return true


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-27 21:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-24  7:32 [ruby-core:55627] [ruby-trunk - Bug #8565][Open] Compiled Regexp comparation bug pyromaniac (Arkady Zabazhanov)
2013-06-24  7:40 ` [ruby-core:55628] [ruby-trunk - Bug #8565] " charliesome (Charlie Somerville)
2013-06-27 20:36 ` [ruby-core:55675] " cedric.brancourt (Cedric Brancourt)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).