From: Jamis Buck Date: 2004-10-20T03:07:28+09:00 Subject: Regexp equality Here's an oddity I recently came across in a unit test. Identical regexps declared with /.../ will be equivilent to each other, but not to the same regexps created with %r{...}: $ ruby -ve 'p( /\/blah/ == /\/blah/ )' ruby 1.8.2 (2004-07-29) [i686-linux] true $ ruby -ve 'p( %r{/blah} == %r{/blah} )' ruby 1.8.2 (2004-07-29) [i686-linux] true $ ruby -ve 'p( /\/blah/ == %r{/blah} )' ruby 1.8.2 (2004-07-29) [i686-linux] false This appears to only be the case when there is a forward slash in the regexp. In other words: $ ruby -ve 'p( /blah/ == %r{blah} )' ruby 1.8.2 (2004-07-29) [i686-linux] true Can anyone else confirm this? Can anyone *explain* it? Or is this a bug? - Jamis -- Jamis Buck jgb3@email.byu.edu http://www.jamisbuck.org/jamis