|
Posted by Bosconian on 07/19/06 04:45
I need a regular expression to validate characters for a given file name. I
want to limit valid characters to the following:
a-z
A-Z
0-9
underscores
hyphens
white spaces
The file name must end with a period and a 3-character extension.
I also want to prevent repeat underscores, hyphens and white spaces.
Example: "__", "--" and " " would all be invalid.
I found this example:
^[a-zA-Z0-9_\s-]+$
This comes close, but it allows repeat underscores, hyphens and white
spaces. It also uses "\s" which allows carriage returns, linefeeds, tabs,
etc.
Any help would be greatly appreciated.
Navigation:
[Reply to this message]
|