不確定是否只想將1410作為4位數字或(1410)與括號匹配,但要排除兩者的匹配,可以確保沒有4位連續數字: (?P<date>\b(?!\d{4}\b)\d{1,2})(?:st|[nr]d|th)?[\s./_\\,-]*(?P<month>\d{1,2}|[a-z]{3,9}) Regex demo 不匹配括號之間的任何日期 \([^()]*\)|(?P<date>\b\d{1,2})(?:st|[nr]d|th)?[\s./_\\,-]*(?P<month>\d{1,2}|[a-z]{3,9}) \([^()]*\)從開始括號到結束括號的匹配 | Or (?P<date>\b\d{1,2})匹配1-2個數字 (?:st|[nr]d|th)? Optionally match st nd rd th [\s./_\\,-]*可選地重復匹配列出的任何 (?P<month>\d{1,2}|[a-z]{3,9})匹配1-2個數字或3-9個字符a-z Regex demo For example import repattern = r"\([^()]*\)|(?P<date>\b\d{1,2})(?:st|[nr]d|th)?(?:[\s./_\\,-]*)(?P<month>\d{1,