From: Brian Candler Date: 2012-09-01T16:20:07+09:00 Subject: Re: Regular Expression Conundrums Stan Stanislaus wrote in post #1074140: > http://pastie.org/4643789 > > Why, in Case 2, do I have to escape the asterisk twice to keep the > program from thinking /\ is a substarter? Thank you all for your help! I > really appreciate this. The string literal '\\' or "\\" is a single backslash. >> "\\".size => 1 >> '\\'.size => 1 >> puts "\\" \ => nil The reason is because backslash-X sequences in string literals have special meanings, so a literal backslash is backslash-backslash In a single quoted string, only \\ and \' are interpreted specially; any other sequences are passed through as-is. In a double-quoted string there are lots more, e.g. \n for newline, \xNN for hex byte. -- Posted via http://www.ruby-forum.com/.