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:
John Mizerek 2026-03-14 16:46:45 -07:00
parent 6862d97350
commit 715d947e4b

View file

@ -2112,7 +2112,8 @@
console.log('Parsing address:', biz.address); console.log('Parsing address:', biz.address);
// Parse from the end forward: ZIP (5 digits), then State (2 letters), then City + AddressLine1 // 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) // Extract ZIP (last 5 digits, optionally with -4)
const zipMatch = remaining.match(/\b(\d{5})(?:-\d{4})?\s*$/); const zipMatch = remaining.match(/\b(\d{5})(?:-\d{4})?\s*$/);