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 :: recursive reverse string 
Javascript :: jquert toggleClass condition 
Javascript :: js sum 
Javascript :: jquery dropdown selected value show field 
Javascript :: how to pass custom regex in jquery validation 
Javascript :: get index in map javascript 
Javascript :: why to use event.persist 
Javascript :: javascript equivalent of CTRL+F5 
Javascript :: kick commands discord.js 
Javascript :: Object of type * is not JSON serializable 
Javascript :: javascript max 
Javascript :: discord js remove reaction from user 
Javascript :: get server side props 
Javascript :: react router lazy load 
Javascript :: vuejs alerts 
Javascript :: generate express app 
Javascript :: how to check if array 
Javascript :: javascript connect metamask 
Javascript :: javascript .firstordefault 
Javascript :: for each array javascript 
Javascript :: how to put space in between characters javascript 
Javascript :: javascript date get next 15 minutes 
Javascript :: javascript primitive data types 
Javascript :: how to check if a date has passed javascript 
Javascript :: nodejs return code 
Javascript :: send variable to javascript promise 
Javascript :: hashtable js 
Javascript :: logical operators in js 
Javascript :: Navigator operation requested with a context that does not include a Navigator. 
Javascript :: js detect if content editable div is empty 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =