From: Todd Benson Date: 2008-07-25T23:27:44+09:00 Subject: Re: weird backsplash behaviour inside single quotes On Fri, Jul 25, 2008 at 8:34 AM, Michal Suchanek wrote: > Hello > > I observe that backslashed characters normally produce backaslash plus > the character inside single quotes. > > > The understandable exception are single quotes. However, in Ruby > double backslash also produces a single backslash. > > irb(main):008:0> '\a' > => "\\a" > irb(main):009:0> '\\a' > => "\\a" > irb(main):010:0> '\\\a' > => "\\\\a" > irb(main):011:0> '\\\\a' > => "\\\\a" > irb(main):012:0> > > > I think this is needlessly confusing. Usually single quotes are as > literal as possible. The backslash is a tool to escape the single quote inside a quote, therefore it must escape itself as well. Todd