Windows FileName Verification

출처(Original Post) :

한글로 업로드를 할 때 Regular Expression을 사용하여, 업로드 되는 파일을 검사하고 싶을 때, 이걸 사용한다. 대개의 경우는 영문,숫자 등으로 이용할 수도 있으나, 이 경우 범용으로 이용되는 이 RegEx를 쓰면 좋을 것이다.

Title Pattern Title
Pattern ^[^\\\./:\*\?\”<>\|]{1}[^\\/:\*\?\”<>\|]{0,254}$
Author Dale Preston
Matching Text abcd.jpg|||a b239.abcd ef12983 298|||a….23498
Non-Matching Text .abcde.jpg|||abcde?.jpg|||c:\abcde.jpg
Description Validates a long filename using Windows‘ rules. Requires one valid filename character other than &quot;.&quot; for the first character and then any number of valid filename characters up to a total length of 255 characters. Unresolved is how to prevent the last character from being a &quot;.&quot; while still meeting all the features that this regex does now.

그럼 영문과 숫자만…즉 영어 파일만 검사하려면?

^[a-zA-Z0-9\._\s-]+$ 의 구문을 쓰면 된다.

IP Address verification

출처(Original Post) :

Title Pattern Title
Pattern ^((0|1[0-9]{0,2}|2[0-9]{0,1}|2[0-4][0-9]|25[0-5]|[3-9][0-9]{0,1})\.){3}(0|1[0-9]{0,2}|2[0-9]{0,1}|2[0-4][0-9]|25[0-5]|[3-9][0-9]{0,1})$
Author Vassilis Petroulias
Matching Text||||||
Non-Matching Text||||||
Description Accurate IP address verification… Each numeric part of an IP address must be between 0 and 255. All patterns I have seen on the net cover this range but they allow leading zeros. The valid cases are: * 0 * 1, 10-19 and 100-199 aka 1[0-9]{0,2} * 2 and 20-29 aka 2[0-9]{0,1} * 200-249 aka 2[0-4][0-9] * 250-255 aka 25[0-5] * 3-9 and 30-99 aka [3-9][0-0]{0,1}

Image File Extension

출처(Original Post) :

Title Image File Extension
Pattern .*(\.[Jj][Pp][Gg]|\.[Gg][Ii][Ff]|\.[Jj][Pp][Ee][Gg]|\.[Pp][Nn][Gg])
Author Steven Smith
Matching Text foo.gif|foo.jpg|foo.png
Non-Matching Text foo.txt||foo.exe
Description This expression should work to validate that an uploaded file’s extension is either jpg, gif, or png.
Source Willem @

Strongish Password

출처 (Original Post) :

Title Strongish Password
Pattern ^[a-zA-Z]\w{3,14}$
Author Steven Smith
Matching Text abcd|||aBc45DSD_sdf|||password
Non-Matching Text afv|||1234|||reallylongpassword
Description The password’s first character must be a letter, it must contain at least 4 characters and no more than 15 characters and no characters other than letters, numbers and the underscore may be used