Skip to content

Update BR regex to split address1 properly#462

Draft
jtrollia wants to merge 1 commit intomainfrom
jt/update-br-address1-regex
Draft

Update BR regex to split address1 properly#462
jtrollia wants to merge 1 commit intomainfrom
jt/update-br-address1-regex

Conversation

@jtrollia
Copy link
Copy Markdown
Contributor

@jtrollia jtrollia commented May 7, 2026

What are you trying to accomplish?

Today, BR's splitAddress1 regex only matches 2-component canonical input (<street>, <number>). When given 3-component input (<street>, <number>, <complement> — common in autofill payloads from Chrome, password managers, and PayPal), the regex bails to the fallback and returns the entire string in streetName.

This adds an optional third capture group for line2 so 3-component inputs are parsed correctly. The change is in BR's region data only; no library code changes.

Backward compatibility: existing 2-component inputs continue to match the regex with no line2 field — confirmed via existing test cases (all unchanged). Adding line2 to the result is additive — consumers reading streetName/streetNumber are unaffected; consumers wanting line2 can opt in.

Note: this leaves combined_address_format untouched. line2 remains canonically in address2. The regex is for parsing flat natural-language strings (which mix all components); the canonical format is for structured serialization. The library already supports this asymmetry by design.

What approach did you choose and why?

...

What should reviewers focus on?

...

The impact of these changes

...

Testing

...

Checklist

  • I have added a CHANGELOG entry for this change (or determined that it isn't needed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant