string timeReg = ""; timeReg = @"(?i)d{1,2}[月]d{1,2}[日]d{2}[:]d{2}|(?i)d{1,2}[月]d{1,2}[日]sd{2}[:]d{2}|(?i)d{1,2}[月]d{1,2}[日]";//取09月16日14:40或者09月16日 14:40(有空格)或09月16日 timeReg = @"(?i)d{4}[-]d{1,2}[-]d{1,2}sd{2}[:]d{2}|(?i)d{4}[-]d{1,2}[-]d{1,2}";//取2019-07-31或者2019-07-31 17:35 timeReg = @"(?i)d{4}[-年/]d{1,2}[-月/]d{1,2}[日]sd{2}[:]d{2}|(?i)d{4}[-年/]d{1,2}[-月/]d{1,2}[日]|(?i)d{2}[:]d{2}";//取2019年07月31日10:35或者2019年07月31日或者10:35 regTime = new Regex(timeReg); MatchCollection matchs = regTime.Matches(str);
regNo = new Regex(@"(?<=[u2e80-uffff])([A-Za-z0-9]+?)(?=航)");//获取中文字符串和“航”字之间的英文数字字符串 regNo = new Regex(@"HA(.+?)(?=[u2e80-uffff])");//获取 “HA”包含并开始到中文字符截至不包含 之间的英文数字字符串