refactor: Update parsing of flight schedule data for improved accuracy and functionality
This commit is contained in:
@@ -13,11 +13,11 @@ const (
|
||||
AirportCode = "airport"
|
||||
Date = "date"
|
||||
Task = "task"
|
||||
IndexPattern = `(?P<idx>\(?L?\d+\)?\.?)`
|
||||
IndexPattern = `(?P<idx>\(?L?[0-9]+\)?\.?)`
|
||||
DatePattern = `\s?(?P<date>\d{2}\w{3})`
|
||||
TaskPattern = `\s?(?P<task>[A-Z]\/[A-Z])`
|
||||
WaypointPattern = `\s?(?P<arr_time>\d{4}(\(\d{2}\w{3}\))?)\/?(?P<airport>\w{3})\/?(?P<dep_time>\d{4}(\(\d{2}\w{3}\))?)`
|
||||
FlightNumberPattern = `\s?(?P<number>[0-9A-Z][A-Z]\d{3,5})`
|
||||
FlightNumberPattern = `\s?(?P<number>[0-9A-Z][0-9A-Z]\d{3,5})`
|
||||
RegisterPattern = `\s?(?P<reg>B\d{4})`
|
||||
)
|
||||
|
||||
@@ -53,6 +53,7 @@ func FindWaypoints(message string) map[string]string {
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func ParseLine(line string) *domain.FlightSchedule {
|
||||
cleanLine := strings.TrimSpace(line)
|
||||
words := strings.Split(cleanLine, " ")
|
||||
|
||||
Reference in New Issue
Block a user