regular expression which should not allow exe file format upload
i have this file upload control which uploads all kinds o f fi开发者_如何学Pythonles. i have to restrict it in such a way that it should not allow exe formats..could anyone please help me with this..i cannot enter allowed file formats as it is unpredictable ..i need to restrict only exe format ..thanks in advance
You can use the regex:
^(?!.*\.exe$).*$
Rubular Link
This regex would match a string beginning with any characters ('^.*') and ending in ".exe" ('\.exe$'):
^(.*\.exe)$
Tested it here: http://www.regexplanet.com/simple/index.html
精彩评论