Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

regular expression to validate if the given input is valid Indian mobile number or not

//Create a regular expression to validate if the given input is valid Indian mobile number or not

const number = '+919876543210';

function validateMobile(number) {
    const regEx = /^(+91|0)?( )?(d{10})$/
    return regEx.test(number)
}

console.log(`is a valid Indian mobile number: ${validateMobile(number)}`)
Comment

PREVIOUS NEXT
Code Example
Javascript :: emmet react self closing tags 
Javascript :: how to make a discord.js 8 ball command 
Javascript :: jquery on scroll down 
Javascript :: get specific item from local storage 
Javascript :: javascript before reload page alert 
Javascript :: font awesome shopping cart icon 
Javascript :: js change url in address bar 
Javascript :: server error payload too large base64 image 
Javascript :: input javascript console 
Javascript :: angular pipe json error 
Javascript :: Javascript noFill 
Javascript :: reactjs change window name 
Javascript :: How to update url using backbone 
Javascript :: remove undefined from array javascript 
Javascript :: enable input jquery 
Javascript :: javascript get object from array where property equals 
Javascript :: hasOwnProperty with more than one property 
Javascript :: capture enter button react input 
Javascript :: js 1d index to 2d coord 
Javascript :: useparams remix 
Javascript :: js get element by class 
Javascript :: jquery check if form is valid 
Javascript :: jquery fadein 
Javascript :: javascript create cookie 
Javascript :: javascript find unique values in array 
Javascript :: datatable language 
Javascript :: javascript regex wrap string 
Javascript :: clear input field data on button click 
Javascript :: remove extra spaces javascript 
Javascript :: detect when page scroll to div javascript no jquery 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =