Make rootPath part of regex greedy

- Fixes #10977