Skip to content

Update BR regex to split address1 properly#462

Open
jtrollia wants to merge 1 commit into
mainfrom
jt/update-br-address1-regex
Open

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

Conversation

@jtrollia

@jtrollia jtrollia commented May 7, 2026

Copy link
Copy Markdown
Contributor

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)

@jtrollia jtrollia requested a review from DominiqueFlaaa May 14, 2026 19:48
@jtrollia jtrollia marked this pull request as ready for review May 19, 2026 13:50
@jtrollia jtrollia requested a review from gabypancu May 19, 2026 18:47
@DominiqueFlaaa DominiqueFlaaa marked this pull request as draft May 26, 2026 15:52
@jtrollia jtrollia marked this pull request as ready for review June 3, 2026 05:50
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