note
cchampion
<p>If you want to use one regex only, you must add an alternation
and thus a /g option, because you need to match two times.</p>
<code>
$directory =~ s{ (?: ^ /* | (?<=[^/])/* $ ) }</>xg;
</code>
<p><b>Update</b> added a look-behind assertion to make the expression
work in all cases. All in all, it's better with two regexes!</p>
314695
314695