Improves the regex used to extract path components and adds some more tests