in reply to Regex question
Slightly improved, but not exactly the same match: m{/(\w+(-\w+)*)/\w+\.txt$}. Note that the . is quoted so it matches a ., not any character. Note also that -\w+ is allowed any number of times (including 0).