From: ts Date: 2004-05-14T21:24:40+09:00 Subject: Re: Regexp Error? >>>>> "R" == Robert Klemme writes: R> irb(main):025:0> "123-456".gsub(/.*$/, 'X') R> => "XX" R> Applying your explanation, one would have to say that "$" is matched R> twice. IMHO this is not correct. Or is there another explanation why R> this gsub happens to return "XX"? This is the same explanation. Your regexp means match a string which is at the end (where end can be \n or the end of string, in this case) * first match : "123-456" * now it's at end * it can match the empty string $ is like ^ : it don't match a character but a position in the string (sort of ...) Guy Decoux