$path =~ m|$magic_word/([^/]+/[^/]+)/|; print "$1\n";