regexphone-number

Regular Expression Validation For Indian Phone Number and Mobile number


I want to validate Indian phone numbers as well as mobile numbers. The format of the phone number and mobile number is as follows:

For land Line number

03595-259506
03592 245902
03598245785

For mobile number

9775876662
0 9754845789
0-9778545896
+91 9456211568
91 9857842356
919578965389

I would like the regular expression in one regex. I have tried the following regex but it is not working properly.

{^\+?[0-9-]+$}

Solution

  • For land Line Number

    03595-259506
    03592 245902
    03598245785
    

    you can use this

    \d{5}([- ]*)\d{6}
    

    NEW for all ;)

    OLD: ((\+*)(0*|(0 )*|(0-)*|(91 )*)(\d{12}+|\d{10}+))|\d{5}([- ]*)\d{6}
    NEW: ((\+*)((0[ -]*)*|((91 )*))((\d{12})+|(\d{10})+))|\d{5}([- ]*)\d{6}
    
    9775876662
    0 9754845789
    0-9778545896
    +91 9456211568
    91 9857842356
    919578965389
    
    03595-259506
    03592 245902
    03598245785
    

    this site is useful for me, and maby for you .;)http://gskinner.com/RegExr/