The patch does not do what you want: >>> re.sub('^/.+', '', '/') '/' >>> re.sub('^/.+', '', '/foo') '' On Thu, Jan 22, 2015 at 5:14 PM, Adam Reichold