From 95d36dc283604065ff394b090f5849be8c5df72b Mon Sep 17 00:00:00 2001 From: Kane Wang Date: Sat, 27 Apr 2024 13:09:16 +0800 Subject: [PATCH] fix floor matching --- src/utils/translate-address-to-english.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/translate-address-to-english.ts b/src/utils/translate-address-to-english.ts index df03d6f..856f50b 100644 --- a/src/utils/translate-address-to-english.ts +++ b/src/utils/translate-address-to-english.ts @@ -105,7 +105,8 @@ export function translateAddressToEnglish( mutableAddress = mutableAddress.replace(numberMatch[0], ""); } - const floorMatch = mutableAddress.match(/(\d+) *樓/); + // match the floor part same as the number part + const floorMatch = mutableAddress.match(/((\d+)(-\d+)?) *樓/); if (floorMatch?.length) { parts.push(`${floorMatch[1]}F.`);