From: Glen Holcomb Date: 2008-09-09T00:31:12+09:00 Subject: Re: Single backslash in a string. How?? ------=_Part_64259_5386127.1220888247074 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Mon, Sep 8, 2008 at 9:18 AM, Rafael Viana wrote: > Lloyd Linklater wrote: > > How about posting the actual code you use to get the bad result and what > > you want as a good result with it? > > The problem is simple > > I want to be able to tell if a variable contains the value "\d", but I > can't seem to be able to represent this value with ruby. > > This problem only occurs with the letters "d" and "l" > > try "\d" and "\\d" in irb and you'll understand what I mean > -- > Posted via http://www.ruby-forum.com/. > > Again we need clarification. Are you trying to match a decimal value i.e. [0..9] or are you trying to match the literal string "\d"? If you are tyring to match the literal string then you want to look for "\\d" (you MUST escape the backslash hence the double backslash). If you are trying to find a decimal character they try =~ /\d/ -- "Hey brother Christian with your high and mighty errand, Your actions speak so loud, I can't hear a word you're saying." -Greg Graffin (Bad Religion) ------=_Part_64259_5386127.1220888247074--