Im trying to match a filename parameter with a regex for validation. I'm having problems with hyphens after numbers...
string: Article_RAR_Scout_13-03-14.pptx
regex:
private bool IsValidFileName(string FileName)
{
if (Regex.IsMatch(FileName, @"^Article[A-Z]{3}_Scout_[0-31]-[0-12]-[0-99]\.pptx$"))
{
return true;
}
else
{
throw new Exception("Please provide a correct file name (e.g. Drillinginfo_WAF_Scout_13-03-14.pptx");
}
}