in reply to Regular expression to check for invalid file name characters

You would be much better using the valid_filename sub from File::Util. Check the manual for it.

File::Util also has escape_filename, to remove/escape bad characters from a path.

Both of these are better than writing your own.
  • Comment on Re: Regular expression to check for invalid file name characters