Finetuning the regex in the isValidPath function

maybe look into combining the two regexes into one, later...