Skip to content

fix: add support for Mercosul motorcycle license plates#458

Merged
hyanmandian merged 4 commits into
brazilian-utils:mainfrom
Henrique-volponi:main
Mar 30, 2026
Merged

fix: add support for Mercosul motorcycle license plates#458
hyanmandian merged 4 commits into
brazilian-utils:mainfrom
Henrique-volponi:main

Conversation

@Henrique-volponi

Copy link
Copy Markdown
Contributor

fix: support motorcycle plates in mercosul validation

The mercosulRegex was only validating car plates (e.g. ABC1D23),
rejecting valid motorcycle plates (e.g. ABC12D3). This fix updates
the regex to cover both formats.

Supported formats

Type Example Pattern
Car ABC1D23 [a-z]{3}[0-9]{1}[a-z]{1}[0-9]{2}
Motorcycle ABC12D3 [a-z]{3}[0-9]{2}[a-z]{1}[0-9]{1}

Changes

  • Updated mercosulRegex in is-valid-license-plate.ts to match both patterns
  • Added test cases for motorcycle plates in is-valid-license-plate.test.ts

No breaking changes. Existing car plate validation remains unaffected.

@hyanmandian

Copy link
Copy Markdown
Member

@Henrique-volponi thanks! just fix the tests please!!

@Henrique-volponi

Copy link
Copy Markdown
Contributor Author

Done! I've fixed the formatting issues (tabs vs spaces) and cleaned up the test comments. The CI should pass now. Thanks!

@hyanmandian hyanmandian merged commit e918164 into brazilian-utils:main Mar 30, 2026
10 checks passed
@hyanmandian

Copy link
Copy Markdown
Member

Thanks for the contribution @Henrique-volponi ! I already published 2.0.1 with this change and added you in our contributor list! Let me know if its now working as expected 🤞

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.

2 participants