Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Phone number Regular expression Help

807599Mar 5 2007 — edited Mar 5 2007
Hi,

I am trying to validate phone number using regular expression.
The format shoud be either of the two given below. It should not
accept phone number of any other format other than the once given below.
I tried out the following regular expression



pn.matches("[\p{+}][0-9]+ ")

but it accepts alphabets too(which is wrong).
How do i check if the phone number is of the following format(OR condition).


0401234567
+358501234567

Any help would be kindly appriciated.
Thanks

Sanam
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 2 2007
Added on Mar 5 2007
20 comments
503 views