|
|
|
@ -191,6 +191,13 @@ func matchPeroidPattern02(base time.Time, str string) (startimer.StarTimer, erro
|
|
|
|
|
reg := regexp.MustCompile(`(每)?([周星期礼拜][周礼拜星期到1-6日天]+)+的?([上中下午夜早凌清晨傍晚里]+)?(\d{1,4}[个点时:]+)?(\d{0,4}[分半:]?钟?)?(\d{1,10}秒?钟?)?`)
|
|
|
|
|
if reg.MatchString(str) {
|
|
|
|
|
pts := reg.FindStringSubmatch(str)
|
|
|
|
|
scs := len(strings.Split(pts[0], "周"))
|
|
|
|
|
if scs > 3 {
|
|
|
|
|
return startimer.StarTimer{}, errors.New("Invalid stings")
|
|
|
|
|
}
|
|
|
|
|
if scs == 3 && !strings.Contains(pts[0], "到") {
|
|
|
|
|
return startimer.StarTimer{}, errors.New("Invalid stings")
|
|
|
|
|
}
|
|
|
|
|
if pts[2] != "" {
|
|
|
|
|
wk := strings.ReplaceAll(pts[2], "周日", "周0")
|
|
|
|
|
wk = strings.ReplaceAll(wk, "礼拜天", "周0")
|
|
|
|
|