Escape filename before using it in a regex. fixes #2430