Category VALIDATIONS

Regular Expression for FileUpload in asp.net

Category: ASP.NETC#.NetVALIDATIONS Comments: No comments

Collection of Regular expression to validate various file formats :- 1.Regular expression to validate file formats for .mp3 or .MP3 Ex: string str= /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.mp3|.MP3|.mpeg|.MPEG|.m3u|.M3U)$/; 2.Regular expression to validate file formats for .doc or .docx Ex: string str= /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.doc|.docx|.DOC|.DOCX)$/; 3.Regular expression to validate file formats for .txt or .TXT Ex: string str= /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.txt|.TXT)$/; 4.Regular expression to validate file formats for .jpeg or .JPEG or .gif or .GIF or .png or .PNG Ex.Read More