1while s#[^/]+/..(/|$)## [download]
In reply to (golf): Cleaning up a path by Roy Johnson in thread Cleaning up a path by polettix