Change
.Pattern = "^ *\d+ *(\d[A-Z]|[A-Z][A-Z\d]) *(\d+) *[A-Z] *(\d{1,2}[A-Z]{3}) *\d[\* ]([A-Z]{3})" & _
"([A-Z]{3}) *([A-Z]{2}\d+) *(\d{4} *\d{4} *\d{1,2}[A-Z]{3}) *[A-Z] *(.*)$"
If .test(txt) Then
Set m = .Execute(txt)(0).submatches
dep = Application.VLookup(m(3), Sheets("airport").Range("a:b"), 2, False)
des = Application.VLookup(m(4), Sheets("airport").Range("a:b"), 2, False)
If IsError(dep) Then dep = m(3)
If IsError(des) Then des = m(4)
a(i, 1) = Application.Trim(.Replace(txt, "$1 $2 $3 " & dep & " " & des & " $6 $7 $8 "))
End If
to
.Pattern = "^ *\d+ *(\d[A-Z]|[A-Z][A-Z\d]) *(\d+) *[A-Z] *(\d{1,2}[A-Z]{3}) *\d[\* ]([A-Z]{3})" & _
"([A-Z]{3}) *[GH]K\d *(\d{4} *\d{4} *\d{1,2}[A-Z]{3}) *[A-Z] *(.*)$"
If .test(txt) Then
Set m = .Execute(txt)(0).submatches
dep = Application.VLookup(m(3), Sheets("airport").Range("a:b"), 2, False)
des = Application.VLookup(m(4), Sheets("airport").Range("a:b"), 2, False)
If IsError(dep) Then dep = m(3)
If IsError(des) Then des = m(4)
a(i, 1) = Application.Trim(.Replace(txt, "$1 $2 $3 " & dep & " " & des & " $5 $6 $7"))
End If
Bookmarks