Skip to content

Instantly share code, notes, and snippets.

@wangye
Created March 7, 2012 02:41
Show Gist options
  • Save wangye/1990543 to your computer and use it in GitHub Desktop.
Save wangye/1990543 to your computer and use it in GitHub Desktop.
VBScript Check File Name
' Check File Name
Function IsAcceptableFileName(fileName)
Set objRegExp = New RegExp
objRegExp.IgnoreCase = True
objRegExp.Global = False
objRegExp.Pattern = _
"^(?!^(PRN|AUX|CLOCK\$|CONFIG\$|" & _
"NUL|CON|COM\d|LPT\d|\..*)" & _
"(\..+)?$)[^\x00-\x1f\\?*:\"";|/]+$"
IsAcceptableFileName = objRegExp.Test(fileName)
Set objRegExp = Nothing
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment