I have a regexp to validate file names. Here is it:
/[0-9a-zA-Z^&'@{}[],$=!-#().\%+~\_ ]+$/
It should allow file names like this:
aaa
aaa.ext
a#
A9#.ext
The following characters are not allowed / : * ? " < > |
The problem is that file names like *.txt
or /kk
passes the validation. I am doing validation with keyup event. So when I put one extra character after not allowed one it shows that everything is correct.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…