string target_p ="2021/09/18";
string target_q ="2021-09-18";
格式yyyy/MM/dd:
MatchCollection mt = Regex.Matches(target_p , "([0-9]{4}/[0-9]{2}/[0-9]{2})");
格式yyyy-MM-dd:
MatchCollection mt = Regex.Matches(target_q, "([0-9]{4}-[0-9]{2}-[0-9]{2})");
原文:https://www.cnblogs.com/RainbowSea/p/15308524.html