Fixed regex to follow APT requirements

Previous implementation would overwrite the file name and potentially include characters that would cause apt to ignore the pref file.

What would happen is that $path would use $name by default.
Then the regex would generate a valid $file_name, then ignore completely by using previously set $path, allowing forbidden characters in the file name.