Hi I need to validate phone number in these formats +91 9425456971 , (123) 986-5470 and 123-569-8740 I have given following regex
validates :phone, format: { with: /\A\(?\d{3}\)?[- ]?\d{3}[- ]?\d{4}\z/,
message: I18n.t('global.errors.phone_format')}
It working for (123) 986-5470 and 123-569-8740 but not for +91 9425456971. Please guide me how to solve this.Thanks in advance
Aucun commentaire:
Enregistrer un commentaire