mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
fix date regex
This commit is contained in:
parent
ba950f3b03
commit
82773aab3b
1 changed files with 3 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ package booking
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -258,11 +259,11 @@ func (bs Service) ParseFromApi(rawContent string) (*Booking, error) {
|
|||
}
|
||||
|
||||
func extractDate(pattern, content string) string {
|
||||
re := regexp.MustCompile(pattern + `\w+\.\s*\d{1,2}\s\w+\.\s\d{4}`)
|
||||
re := regexp.MustCompile(pattern + `\w+\.\s*\d{1,2}\s\w+\.*\s\d{4}`)
|
||||
dateMatch := re.FindString(content)
|
||||
|
||||
if dateMatch == "" {
|
||||
fmt.Println("date not found")
|
||||
log.Println("date not found")
|
||||
return ""
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue