From: Shri Borde Date: 2009-02-05T08:32:11+09:00 Subject: [ruby-core:21842] Regexp interpolation does not give equality --_000_710DF26F214D2B4BB94287123FFE980A2DD53BF5F7NAEXMSGC104re_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Any idea why the second expression results in false? Its seems like both th= e regexpes are similar (to_s gives the same result), but the =3D=3D method = just fails to realize that they are really identical. irb(main):001:0> re =3D /Hello/ =3D> /Hello/ irb(main):002:0> /#{re}/ =3D=3D /Hello/ =3D> false irb(main):002:0> /#{re}/.to_s =3D=3D /Hello/.to_s =3D> true irb(main):003:0> str =3D "Hello" =3D> "Hello" irb(main):004:0> /#{str}/ =3D=3D /Hello/ =3D> true Thanks, Shri --_000_710DF26F214D2B4BB94287123FFE980A2DD53BF5F7NAEXMSGC104re_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Any idea why the second expression results in false? I= ts seems like both the regexpes are similar (to_s gives the same result), but = the =3D=3D method just fails to realize that they are really identical.

 

irb(main):00= 1:0> re =3D /Hello/

=3D> /Hel= lo/

irb(main):00= 2:0>  /#{re}/ =3D=3D /Hello/

=3D> false

irb(main):00= 2:0> /#{re}/.to_s =3D=3D /Hello/.to_s

=3D> true=

irb(main):00= 3:0> str =3D "Hello"

=3D> "Hello"

irb(main):00= 4:0> /#{str}/ =3D=3D /Hello/

=3D> true=

 

Thanks,

Shri

 

--_000_710DF26F214D2B4BB94287123FFE980A2DD53BF5F7NAEXMSGC104re_--