开发者

regular expression which should not allow exe file format upload

开发者 https://www.devze.com 2023-02-14 08:27 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号