SVG中年月日相关的表达式

// 年份
static string PatternYear { get; set; } = @"(<g>)?(?<Start><text.*>)(?<Year>\d{4}年?)(?<End><\/text>)(<\/g>)?"; 
// 英文月份
static string PatternEnglishMonth { get; set; } = @"(?<Start><text.*>)(?<EngMonth>[A-Za-z]{3,})(?<End></text>)";
// 数字月份
static string PatternMonthNo { get; set; } = @"(?<Start><text.*>)((?<MonthNo>\d{1,2})|(?<Month2>(0?\d|d{2})))(?<End></text>)"; 
// "阳历月" (3字母以上的英文+1至2字的数字月份)。如匹配:”Jan 1“或”February 02“等
static string PatternMonth { get; set; } = "((" + PatternEnglishMonth + @"[\r\n\t ]*" + PatternMonthNo + ")|(" + PatternMonthNo + @"[\r\n\t ]*" + PatternEnglishMonth + "))";
// "英文月" (包括全称或3字简称)。 如匹配:“JANUARY”"FEB"“MAY”等,如忽略大小写,可以匹配:”Jan“, ”JaNuary“, ”May“, ”October“等。
static string PatternEngMonthName { get; set; } = @"((JAN(UARY)?|MA(R(CH)?|Y)|JUL(Y)?|AUG(EST)?|OCT(OBER)?|DEC(EMBER)?))|(SEPT|NOV|DEC)(EMBER)?|FEB(RUARY)?|APR(IL)?|JU((LY?)|(NE?))";
//阳历日期
static string PatternDate { get; set; } = @"(<g>)?(?<Start><text.*>)(?<Date>\d{1,2})(?<End><\/text>)(<\/g>)?";
//“干支”,如匹配:丙辰
static string PatternGanZhi { get; set; } = @"(?<Start><text[^>].*>)(?<GanZhi>[甲乙丙丁戊己庚辛壬癸]{1}[子丑寅卯辰巳午未申酉戌亥]{1}[年月日]?[^<]*)(?<End></text>)";
//“生肖年”。如匹配:“牛年”“虎”等。
static string PatternAnimal { get; set; } = @"<text[^>].*>[鼠牛虎兔龙蛇马未㺅鸡狗猪]{1}年?.*<\/text>"; //<text[^>].*>[鼠牛虎兔龙蛇马未㺅鸡狗猪]{1}年?.*<\/text>
//“简称英文星期”
static string PatternWeekName { get; set; } = @"(?<Start><text.*>)(?<WeekName>[\s\t ]*[A-Z]{2,3})(?<End>[\s\t ]*</text>)";
//“简称英文星期+中文序号”。匹配:“SUN日”“MO一”等。
static string PatternWeekCnName { get; set; } = @"(?<Start><text.*>[\s\t]*)(?<WeekCnName>[A-Z]{2,3}[\s\t\ ]*[日一二三四五六]{1})(?<End>[\s\t\ ]*</text>)";
//“农历年+农历月”。匹配:“壬寅年   丁丑月”等
static string PatternLuarYearMonth { get; set; } = @"(?<Start><text.*>[\s\t]*)(?<LuarYearMonth>[甲乙丙丁戊己庚辛壬癸]{1}[子丑寅卯辰巳午未申酉戌亥]{1}年?[\s\t]*[\[\{\(\(\{\[\【]?[甲乙丙丁戊己庚辛壬癸]{1}[子丑寅卯辰巳午未申酉戌亥]{1}月?[\s\t\r\n ]*[\]\}\)\)\}\]\】]?)(?<End>[\s\t\r\n\ ]*</text>)";
//“农历年+农历月”(含text标签)。匹配类似:“甲寅年  戊辰月”
static string PatternFullLuarYearMonth { get; set; } = @"(?<Start><text.*>[\s\t]*)(?<LuarYear>[甲乙丙丁戊己庚辛壬癸]{1}[子丑寅卯辰巳午未申酉戌亥]{1}年?)[\s\t\r\n ]*(?<LuarMonth>[\[\{\(\(\{\[\【]?[甲乙丙丁戊己庚辛壬癸]{1}[子丑寅卯辰巳午未申酉戌亥]{1}月?[\s\t\r\n ]*[\]\}\)\)\}\]\】]?)(?<End>[\s\t\r\n]*</text>)";
//“农历年+生肖”(纯文字)。匹配:“壬寅【虎】”"丁丑(羊)"“甲辰{龙}”等。
static string PatternYearAnimal { get; set; } = @"(?<Start><text.*>[\s\t]*)(?<LuarYear>[甲乙丙丁戊己庚辛壬癸]{1}[子丑寅卯辰巳午未申酉戌亥]{1}年?)[\s\t]*[{【\{\[(\(](?<Animal>[鼠牛虎兔龙蛇马未㺅鸡狗猪]{1}年?)[】\}\]\))}](?<End>[\s\t\r\n]*</text>)";
//“农历年+生肖年”(含text标签)。如匹配:“壬寅年【虎年】”,“丁丑  (牛)”等
static string PatternFullYearAnimal { get; set; } = @"(?<Start><text.*>[\s\t]*)(?<LuarYear>[甲乙丙丁戊己庚辛壬癸]{1}[子丑寅卯辰巳午未申酉戌亥]{1}年?)[\s\t\r\n ]*[【\{\[(\(](?<Animal>[鼠牛虎兔龙蛇马未㺅鸡狗猪]{1}年?)[】\}\]\))](?<End>[\s\t\r\n]*</text>)";
//“农历日”
static string PatternLuarDate { get; set; } = @"(?<Start><text.*>[\s\t]*)(?<LuarDate>[初一二三四五六七八九十廿]{2})(?<End>[\s\t]*</text>)";

为方便使用,不加序号,用加粗字代表标题。 

猜你喜欢

转载自blog.csdn.net/johnsuna/article/details/121324433