Regular expression that should not allow loading of exe file format

I have this file upload control that downloads all kinds of files. I have to limit it so that it does not allow exe formats. Can anyone help me on this. I cannot enter valid file formats, as this is unpredictable .. I need to limit only the exe format. promotion

+3
source share
2 answers

You can use regex:

^(?!.*\.exe$).*$

Ruble link

+4
source

This regular expression will match a line starting with any character ('^. *') And ending with ".exe" ('\ .exe $'):

^(.*\.exe)$

: http://www.regexplanet.com/simple/index.html

0

Source: https://habr.com/ru/post/1795998/


All Articles