title: Regular expression to shorten file paths
body: <p>I need to shorten file paths for a report I'm working on for NTFS and share permissions. I'm trying to remove for example <code>\\</code> in share paths and <code>C:\</code> in drive paths and replace any slashes thereafter with <code>&gt;</code>. I also need to shorten the path down to just the last folder but taking into account spaces and special characters. Between the <code>&gt;</code> and the folder name it needs a space.</p>
  
  <p>So for example <code>\\Finance\Accounts &amp; Payroll\Sage</code> becomes <code>&gt;&gt; Sage</code>.</p>
  
  <p>And <code>D:\HR\Personnel\Records\Holidays\2015</code> becomes <code>&gt;&gt;&gt;&gt; 2015</code>.</p>