Hej!
Jag har följande funktion som söker ut postnummer och ort från en sammansatt sträng:
Function SplitAddress(sMergedAddress)
dim re, matches, match
dim sInput, sPostalNr, sCity
dim a(1)
sInput = trim(sMergedAddress)
sPostalnr = ""
sCity = ""
set re = new regexp
re.ignorecase = true
re.pattern = "^(\d+\s*\d+)\s*([a-zåäö]+)$"
if not re.test(sInput) then
sCity = sInput
else
set matches = re.execute(sInput)
set match = matches(0)
sPostalnr = match.submatches(0)
sCity = match.submatches(1)
end if
a(0) = sPostalNr
a(1) = sCity
SplitAddress = a(0) & chr(9) & a(1)
End Function
Men, följande orter fungerar inte (troligtvis för att ortnamnet består av två ord eller att det finns ett mekllansteg i namnet:
421 32 V-FRÖLUNDA
426 77 VÄSTRA FRÖLUNDA
422 43 HISINGS BACKA
Hur fixar man till det?
Mvh
Henrik