I need to know if a given string is a valid DateTime format string because the string may represent other things. I tried DateTime.ParseExact(somedate.ToString(format), format)
Something like
Regex regex = new Regex("^(y|Y|m|M|d|D|s|S|h|H)+$"); if (regex.IsMatch('DateTime String')) { // 'valid' }
if you're literally searching for those characters and not the numerical representation for a given date and time