From: ts Date: 2002-04-27T00:31:56+09:00 Subject: Re: expand_path and overlap >>>>> "M" == Morris, Chris writes: >> collapse_path("b/c/f", "/a/b/c/d/e/b/c/g/h") >> #^^^^^^^^^^^^ or whatever :-) M> At the moment, I'm thinking it should be: M> /a/b/c/d/e/b/c/f Well, try this def collapse_path(p, m) if %r{^([^\0]*/)([^\0]+)(?:/|\z)[^\0]*\0\2(.*)} =~ m + "\0" + p $1+ $2 + $3 else m + "/" + p end end but verify it :-)) Guy Decoux