Commit 7a56ecd
committed
fix(isMobilePhone): fix es-PA regex to validate only Panamanian mobile numbers
The previous regex /^(\+?507)\d{7,8}$/ was too permissive:
- Allowed any starting digit after country code (should be 6 for mobile)
- Accepted 7 or 8 digit lengths (mobile must be exactly 8 digits)
- Did not support hyphenated format (6XXX-XXXX)
The new regex /^(\+?507)6\d{3}-?\d{4}$/ enforces:
- Mobile numbers must start with 6
- Exactly 8 digits after country code
- Optional hyphen in 6XXX-XXXX format
References:
- https://en.wikipedia.org/wiki/Telephone_numbers_in_Panama
- Panamanian mobile numbers: +507 6XXX-XXXX
Fixes #24331 parent 9fa1e3a commit 7a56ecd
2 files changed
Lines changed: 10 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9588 | 9588 | | |
9589 | 9589 | | |
9590 | 9590 | | |
9591 | | - | |
9592 | | - | |
9593 | | - | |
9594 | | - | |
| 9591 | + | |
| 9592 | + | |
| 9593 | + | |
| 9594 | + | |
| 9595 | + | |
9595 | 9596 | | |
9596 | 9597 | | |
9597 | 9598 | | |
9598 | 9599 | | |
9599 | 9600 | | |
9600 | 9601 | | |
9601 | 9602 | | |
| 9603 | + | |
| 9604 | + | |
| 9605 | + | |
| 9606 | + | |
9602 | 9607 | | |
9603 | 9608 | | |
9604 | 9609 | | |
| |||
0 commit comments