Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular expression for mobile number error in case 1 1 1 1 1 1 [duplicate]

Tags:

regex

I want a regular expression for mobile number validation. I have tried below regular expression. If I enter 1 1 1 1 1 1 it will not be accepted. Will you please help to to find what is my mistake in regular expression.

Regular expression is: ^\s*\+?\s*([0-9][\s-]*){6,}$

like image 779
Bansi Sachade Avatar asked Dec 05 '25 00:12

Bansi Sachade


1 Answers

You can use regex like this ::::

/^[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4,6}$/im

Here i makes the expression case-insensitive and m performs multi-line searches

Or

^([0-9]*){6,}$

Check any number with this regex

like image 85
Aarsh Avatar answered Dec 07 '25 16:12

Aarsh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!