Validating strings
Posted: Fri Dec 03, 2010 4:57 am
What sort of validation do you use for the validation of strings? Say you have form fields for user input of names, or street, etc.
What I have now are NotEmpty and StringLength. So a family name must be filled in and be between 1 and 100 characters long. Could also be 200 chars (you never know what strange long name someone might have.
However, I'm not sure what else to do. Like alnum is too restrictive. And I haven't come up with a good regex yet. Most of them are too restrictive for general use. A user might have characters other then the regular abc in his name (think French, Hebrew, etc)
What I have now are NotEmpty and StringLength. So a family name must be filled in and be between 1 and 100 characters long. Could also be 200 chars (you never know what strange long name someone might have.
However, I'm not sure what else to do. Like alnum is too restrictive. And I haven't come up with a good regex yet. Most of them are too restrictive for general use. A user might have characters other then the regular abc in his name (think French, Hebrew, etc)