Answers for "how to yup phone number validation"

0

yup checking phone number is valid react

const phoneRegExp = /^((\+[1-9]{1,4}[ \-]*)|(\([0-9]{2,3}\)[ \-]*)|([0-9]{2,4})[ \-]*)*?[0-9]{3,4}?[ \-]*[0-9]{3,4}?$/

phoneNumber: Yup.string().matches(phoneRegExp, 'Phone number is not valid')
Posted by: Guest on December-08-2020

Browse Popular Code Answers by Language