I have a regex for file name validation. Here it is:
/^[0-9a-zA-Z\^\&\'\@\{\}\[\]\,\$\=\!\-\#\(\)\.\%\+\~\_; ]+$/
How do I change it to check for file name not to start with . symbol. Thanks for help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A negative lookahead will be the easiest solution:
Alternatively, you can match the first character with an extra character class:
Btw, inside a character class nearly all special characters loose their function and will not need to be escaped.