mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-12 13:46:51 +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 (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -258,11 +259,11 @@ func (bs Service) ParseFromApi(rawContent string) (*Booking, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractDate(pattern, content string) string {
|
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)
|
dateMatch := re.FindString(content)
|
||||||
|
|
||||||
if dateMatch == "" {
|
if dateMatch == "" {
|
||||||
fmt.Println("date not found")
|
log.Println("date not found")
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue