in my application i want to validate the telephone numbers, how can i write regular expression for telephone numbers like..
040-23357399 or 04023357399
91-40-23357399 or 914023357399
08518-2814655 or 085182814655
91-8518-2814655 or 9185182814655
this is my phone numbers how can i write the expression for this
Validation implies rejection, and your users will find that annoying. A better option is to accept as much as possible by first stripping all non-digits from the string, and then checking the length and initial digits vs a few simple rules:
This passes a lot more through than trying to force your users into a specific format, and makes for simpler, faster validation code. Then you just format it nicely whenever you re-display it.