Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Regular Expression : @"^(?:[\w]\:|\\)(\\[A-Z_\a-z_\-\s0-9\.]+)+\.(txt|gif|pdf|doc|docx|xls|xlsx|mht|pptx|ppt)$"
you can add any no of extensions to above regex expression.
How to use check is a filepath is matching with regular expression.
if(Regex.IsMatch(filePath, @"^(?:[\w]\:|\\)(\\[A-Z_\a-z_\-\s0-9\.]+)+\.(txt|gif|pdf|doc|docx|xls|xlsx|mht|pptx|ppt)$"))
{
// put your code here
}