maybe ``(?:/.*)?`` instead (i.e. being either then end of the path (case of a matched file) or followed by a directory separator (case of files in the matched folder)