+ Start a Discussion
asish1989asish1989 

Regex For 999-999-9999

Hi
can any one tell me regex form of 999-999-9999 this?

I have used phoneRegex = '\\D*?(\\d\\D*?){10} but Now I want to restrict the special charatcter entry. It is acepting all the  special characters

I am giving this input.It is taking, I want to restrict that.

how will I do, please give me some suggession as soon as possible.

 

 

Thanks

 

 

Best Answer chosen by asish1989
asish1989asish1989

Thanks Everyone for reply I got solution,

I have used this regex expression    ^\\(\\d{3}\\)\\s?\\d{3}-\\d{4}

 

Thanks

 

All Answers

ssssssssssssss

Try this :

 

 

^\d{3}-\d{3}-\d{4}$

 

 

If this helps you..please mark as Solved..and hit Kudos....so that others can benefit!

 

 

~Sumit

asish1989asish1989

Hi

I am sorry, I want  regex for  this format (999) 999-9999.I f you enter simply number and click on out side It will convert to this format,But I want to avoid special character.

 

Please help me as soon as possible

 

Thanks

 

asish1989asish1989

Thanks Everyone for reply I got solution,

I have used this regex expression    ^\\(\\d{3}\\)\\s?\\d{3}-\\d{4}

 

Thanks

 

This was selected as the best answer
Kamal MehtaKamal Mehta
HI asish1989 that was an excellent solution, saved a lot of time for us :)