regex phone number code example

Example 1: javascript regex french phone number

function regexPhoneNumber(str) {
	const regexPhoneNumber = /^((\+)33|0)[1-9](\d{2}){4}$/; 
  
	if (str.match(regexPhoneNumber)) {
		return true;
	} else {
		return false;
	}
}

let phoneNumber = "+33777777777";
console.log(regexPhoneNumber(phoneNumber));

Example 2: phone number regex

^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$

Example 3: indian phone pattern regex

pattern:
^(?:(?:\+|0{0,2})91(\s*[\ -]\s*)?|[0]?)?[456789]\d{9}|(\d[ -]?){10}\d$


//Valid Scenarios:
4567589390
5678896759
6788509595
+91-9883443344
9883443344
09883443344
919883443344
0919883443344
+919883443344
+91-9883443344
0091-9883443344
+91 -9883443344
+91- 9883443344
+91 - 9883443344
0091 - 9883443344
7856128945
9998564723
022-24130000
080 25478965
0416-2565478
08172-268032
04512-895612
02162-240000
+91 9883443344
022-24141414


//Invalid Scenarios:
WAQU9876567892
ABCD9876541212
0226-895623124
6589451235
0924645236
0222-895612
098-8956124
022-2413184

Example 4: phone number regex

^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$

Example 5: regex pattern for mobile number

/^(\+\d{1,3}[- ]?)?\d{10}$/

Example 6: valid phone number regex with country code

((00)?(\+)?\d{1,3})[-\s]+(\d{1,3})[-\s]+(\d{4,10})