Admittedly this is pre-existing but this regex is pretty magical, but since this PR is dealing with expanding hierarchy levels that look like `%{foo}/%{bar}` I'm going to nitpick a little. This is automatically assuming that we're using `/` as the file separator, which means that this will not behave as expected on Windows.