in reply to Re: dir / file split
in thread dir / file split

note: for the string "foo/bar/" the OP's RE will match ("foo/bar",""), but your will not match at all.
Also there's no need to worry about greedyness in the OP case: the backtracking for "foo/bar/cuz" will start tring to match "foo/bar/cuz" then "foo/bar/cu", "foo/bar/c" and so on till "foo/bar", which allow to finish correctly the RE in that order.
use re 'debug'; could help

Oha