Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/AddressSplitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,23 @@ public static function splitAddress($address)
#########################################################################
(?:(?P<B_Addition_to_address_1>.*?),\s*(?=.*[,\/]))? # Addition to address 1
(?!\s* ' . $houseNumberPrefixes . ')
(?P<B_Street_name>[^0-9# ]\s*\S(?:[^,#](?!\b\pN+\s))*?(?<!\s)) # Street name
(?P<B_Street_name>
(?:
# Special case for Mannheim, Germany-style ("block") street names with a single letter followed
# by one or more digits.
\pL
\pN+
)
|
(?:
# Any other street name.
[^0-9# ]
\s*
\S
(?:[^,#](?!\b\pN+\s))*?
(?<!\s)
)
) # Street name
\s*[\/,]?\s*(?:\s ' . $houseNumberPrefixes . ')?\s*
(?P<B_House_number_match>
(?P<B_House_number_base>
Expand Down
42 changes: 42 additions & 0 deletions tests/AddressSplitterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,48 @@ public function validAddressesProvider()
'additionToAddress2' => ''
)
),
array(
// Example: Mannheim, Germany
'L14 10',
array(
'additionToAddress1' => '',
'streetName' => 'L14',
'houseNumber' => '10',
'houseNumberParts' => array(
'base' => '10',
'extension' => '',
),
'additionToAddress2' => '',
),
),
array(
// Example: Mannheim, Germany
'L1 1',
array(
'additionToAddress1' => '',
'streetName' => 'L1',
'houseNumber' => '1',
'houseNumberParts' => array(
'base' => '1',
'extension' => '',
),
'additionToAddress2' => '',
),
),
array(
// Example: Mannheim, Germany
'L14 1',
array(
'additionToAddress1' => '',
'streetName' => 'L14',
'houseNumber' => '1',
'houseNumberParts' => array(
'base' => '1',
'extension' => '',
),
'additionToAddress2' => '',
),
),
);
}

Expand Down