Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

yup phone number

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')
Comment

yup phone number validation

// See https://repl.it/repls/PartialAlicebluePrediction
import * as yup from 'yup';
// const yup = require("yup");
import "yup-phone";
// require("yup-phone");

// validate phone number strictly in the given region
const phoneSchema = yup.string()
  .phone("IN", true)
  .required();

console.log(phoneSchema.isValidSync("+919876543210")); // → true
Comment

PREVIOUS NEXT
Code Example
Javascript :: import map in angular 
Javascript :: how to select html body in javascript 
Javascript :: react native scrollview horizontal 
Javascript :: upgrading node on mac 
Javascript :: fetch get authorization header 
Javascript :: js scrolling in div 
Javascript :: node js for loop 
Javascript :: numero aleatorio js 
Javascript :: minus month javascript date 
Javascript :: jquery radio button click event 
Javascript :: javascript write in id 
Javascript :: how to append select option in jquery 
Javascript :: remove first select option jquery 
Javascript :: javascript does key exist 
Javascript :: devextreme datagrid get selected row keys 
Javascript :: hack google dinosaur 
Javascript :: jquery show for 5 seconds 
Javascript :: Ignoring TypeScript Errors in next js 
Javascript :: nodemailer types 
Javascript :: delete all children of div 
Javascript :: JSONStringify c# 
Javascript :: Error: Material-UI: The data grid component requires all rows to have a unique id property. 
Javascript :: am pm to 24 hours converter javascript 
Javascript :: disable eslint for react project 
Javascript :: generate random date in javascript 
Javascript :: string to url javascript 
Javascript :: chart js no points 
Javascript :: cep validator js 
Javascript :: remove quotes from array javascript 
Javascript :: add AppLoading expo 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =