in reply to Regular expression to check for invalid file name characters
Why not just let the OS tell you if it's invalid? There's a bug that \0 will be treated as the end of string, so that's the only one you actually have to check for.
Now, if you're doing this for security reasons, a much better approach is to check for the characters you want to allow (as opposed to those you want to disallow). That way, you don't actually miss any.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regular expression to check for invalid file name characters
by BrowserUk (Patriarch) on Feb 22, 2010 at 16:16 UTC | |
by ikegami (Patriarch) on Feb 22, 2010 at 16:24 UTC | |
by BrowserUk (Patriarch) on Feb 22, 2010 at 16:37 UTC | |
by merrymonk (Hermit) on Feb 22, 2010 at 16:53 UTC | |
by BrowserUk (Patriarch) on Feb 22, 2010 at 16:59 UTC |