Skip to content

Commit

Permalink
🐛 [#607] Patch regex for phone number validation
Browse files Browse the repository at this point in the history
The first character of the phone number may only be a plus sign or
a number (4-digit phone numbers can be called, so only allowing a
zero would be too strict). For grouping, dashes and spaces may be
used, but these characters are not valid for the first character.
  • Loading branch information
sergei-maertens committed Dec 7, 2023
1 parent f9cedbf commit 51eea3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/formio/components/PhoneNumberField.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import enableValidationPlugins from '../validators/plugins';

const PhoneNumber = Formio.Components.components.phoneNumber;

const PHONE_NUMBER_REGEX = /^\+{0,1}[- 0-9]{0,}$/;
const PHONE_NUMBER_REGEX = /^[+0-9][- 0-9]+$/;

const PhoneNumberValidator = {
key: 'validate.phoneNumber',
Expand Down

0 comments on commit 51eea3a

Please sign in to comment.