DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,673 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Techsolutionstuff
Techsolutionstuff

Posted on • Originally published at techsolutionstuff.com

How To Validate 10 Digit Mobile Number Using Regular Expression

In this article we will see how to validate 10 digit mobile number using regular expression in PHP or Laravel. here i will give you example of regex for 10 digit mobile number in jQuery.

Regular Expression through user can enter numbers in different format as per their requirements. When we are working with form validation at that time you need to restrict user to enter invalid value and users allow only numeric value or valid number.

So let's see regular expression for 10 digit mobile number

Example :

<html>
<head>
   <title>How To Validate 10 Digit Mobile Number Using Regular Expression - techsolutionstuff.com 
   </title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<form>
    <h1>How To Validate 10 Digit Mobile Number Using Regular Expression - techsolutionstuff.com</h1>
   <div class="col-md-6">
    <label>Mobile Number: </label>
    <input class="form-control" type="text" name="mo_no" placeholder="Mobile Number" minlength="10" maxlength="10" required>
    <br>
    <label>Mobile Number: </label>
    <input type="text" class="form-control" name="mo_no" placeholder="Mobile Number" pattern="[1-9]{1}[0-9]{9}"  required ><br>
    <button type="submit" class="btn btn-success">Submit</button>
  </div>
</form>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

How To Validate 10 Digit Mobile Number Using Regular Expression<br>


You might also like :

Top comments (0)

Visualizing Promises and Async/Await 🀯

async await

☝️ Check out this all-time classic DEV post