Java Regular Expression Mobile No Validation


Write a java program to check whether a given number is a valid mobile number or not

import java.util.regex.*;
class RegexDemo6
public static void main(String[] args)
Pattern p=Pattern.compile("(0/91)?[7-9][0-9]{9}");
Matcher m=p.matcher(args[0]);
if(m.find() &&[0]))
System.out.println("valid mobile number");
System.out.println("invalid number");

1st run : java RegexDemo6 9439202111
valid mobile number
2nd run : java RegexDemo6 929292929292
invalid number

Java Regular expression program to check whether a given mail id is valid or invalid mail id.

Our Services:

Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Data Science with Python Training | Projects

SILAN Technology, BBSR
Call to: 0674-2361252