in reply to Re^3: Regular expression to check for invalid file name characters
in thread Regular expression to check for invalid file name characters

I assumed the opposite.

Even so, you could still succeed in creating a file within a subdirectory by accident.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"
  • Comment on Re^4: Regular expression to check for invalid file name characters

Replies are listed 'Best First'.
Re^5: Regular expression to check for invalid file name characters
by merrymonk (Hermit) on Feb 22, 2010 at 16:53 UTC
    I was trying to make the application as user friendly as possible. Therefore I thought it worthwhile checking that all the characters supplied could be used (rather than getting a system error message which may not be that good to work with).
    Also, I should have said that I am working on Windows - hence the list of invalid characters I gave in the subroutine.

      I understand. And I think it is a good thing to check if the filenames are supplied by (especially novice) users.

      If they enter a filename "temp\fred.txt", you could end creating fred.txt in the temp subdirectory rather than their expectation on a file called temp\fred.txt in \.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.