Strip country suffix before address parsing in wizard
Handles "United States/USA" at end of address string that was blocking ZIP and state regex extraction. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6862d97350
commit
715d947e4b
1 changed files with 2 additions and 1 deletions
|
|
@ -2112,7 +2112,8 @@
|
|||
console.log('Parsing address:', biz.address);
|
||||
|
||||
// Parse from the end forward: ZIP (5 digits), then State (2 letters), then City + AddressLine1
|
||||
let remaining = biz.address.trim();
|
||||
let remaining = biz.address.trim()
|
||||
.replace(/,?\s*(United States|USA|US|U\.S\.A?\.)?\s*$/i, '').trim();
|
||||
|
||||
// Extract ZIP (last 5 digits, optionally with -4)
|
||||
const zipMatch = remaining.match(/\b(\d{5})(?:-\d{4})?\s*$/);
|
||||
|
|
|
|||
Reference in a new issue