From: "Peter Schüller" Date: 2002-10-01T20:29:31+09:00 Subject: regex problem hello ! i have a problem with ruby's gsub function: i want to substitute one \ with two \\ in irb this looks as follows: > x = '/\\' "/\\" > puts x /\ nil > # this works > puts x.gsub(/\\/,'a') /a nil > # the following is the problem: > puts x.gsub(/\\/,'\\\\') /\ nil > # why not /\\ ? > puts x.gsub(/\\/,'a').gsub(/a/,'\\\\') /\ nil > # why not /\\ ? > puts x.gsub(/\\/,'\\\\\\') /\\ nil > # why ???? thanks in advance, peter