Question
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Capgemini
IN
Last activity: 4 Jan 2016 11:53 EST
How to avoid numbers like 9999999999(repeating) in US phone format?
Hi All,
I have a field 'Telephone Number'.That should be in US Phone format...(xxx) xxx-xxxx.
And it shouldn't accept repeating numbers like 9999999999.
How to develop REGEX for this.
Pls Help.
-
Like (0)
Bukhari Saheb Shaik SK SHAHIR HALIM Vema Reddy Bajari bret wilkins -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems
IN
There are lot of suggestions here - http://stackoverflow.com/questions/123559/a-comprehensive-regex-for-phone-number-validation
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Capgemini
IN
Thanks Rajiv.
But that doesn't work out....Actually i am looking fot the regex which supports US format (XXX) XXX-XXXX and which doesn't support phone numbers like 9999999999.
Regards,
Praveen
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems Inc.
US
Hello,
It seems that link at comment 27 has a cheat sheet that seems align to the requirements you mention.
Let me know if you review that item.
Regards
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689977000/ca5d61dc-47bd-406c-8ea6-9d6a790a4f7e.jpg?itok=O3xagdnP)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689977000/ca5d61dc-47bd-406c-8ea6-9d6a790a4f7e.jpg?itok=O3xagdnP)
Pegasystems Inc.
IN
We have an OOTB edit validate rule which does the same and uses a reg-ex pattern.
Edit Validate : USPhone
Please use this edit validate rule in property rule form and let us know if this helps.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Capgemini
IN
Yeah...we have Edit Validate rule...But that is not restricting the numbers like 9999999999..
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689977000/ca5d61dc-47bd-406c-8ea6-9d6a790a4f7e.jpg?itok=O3xagdnP)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689977000/ca5d61dc-47bd-406c-8ea6-9d6a790a4f7e.jpg?itok=O3xagdnP)
Pegasystems Inc.
IN
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Capgemini
IN
That will do that...if u give more than 10 or below.
But it is not restricting repeating numbers like 1111111111....(This number doesnt exists)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689977000/ca5d61dc-47bd-406c-8ea6-9d6a790a4f7e.jpg?itok=O3xagdnP)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689977000/ca5d61dc-47bd-406c-8ea6-9d6a790a4f7e.jpg?itok=O3xagdnP)
Pegasystems Inc.
IN
Yes, if a number is exactly of 10 chars, it will auto format it to (111) 111-1111 and if < or > 10 chars validation error will be thrown.
So you want to enforce the user to enter it in (XXX) XXX-XXXX format and no auto-formatting should be applied?
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689977000/ca5d61dc-47bd-406c-8ea6-9d6a790a4f7e.jpg?itok=O3xagdnP)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689977000/ca5d61dc-47bd-406c-8ea6-9d6a790a4f7e.jpg?itok=O3xagdnP)
Pegasystems Inc.
IN
Updated: 4 Jan 2016 8:28 EST
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
PEG
GB
Hello Praveen,
Please be aware that 6175551212 is a valid US phone number, even if it is not in the format you desire..
It seems you are asking for an edit validation that
1. requires a certain format.- area code in parenthesis, exchange followed by a hyphen, etc.
You should review the requirements to ensure that the phone number must be entered in this format and not just displayed in this format.
2. disallows the user from entering the usual fake numbers to get around the requirement for a number, such as all 10 digits being the same.
You may also want to disallow other fake numbers such as 1112223333 or 121212121.
If you do not want both sets of functionality, you need to clarify which you need.
Realize that regardless of the editing, someone who doesn't want to enter a number (or doesn't have one) will find ways around the edits.
For example, (303) 555-1212 (at one point in the past - Denver's directory assistance) is one I often use.
Or sometimes, I'll flip over to the website's contact page and copy one of their own phone numbers.
Hello Praveen,
Please be aware that 6175551212 is a valid US phone number, even if it is not in the format you desire..
It seems you are asking for an edit validation that
1. requires a certain format.- area code in parenthesis, exchange followed by a hyphen, etc.
You should review the requirements to ensure that the phone number must be entered in this format and not just displayed in this format.
2. disallows the user from entering the usual fake numbers to get around the requirement for a number, such as all 10 digits being the same.
You may also want to disallow other fake numbers such as 1112223333 or 121212121.
If you do not want both sets of functionality, you need to clarify which you need.
Realize that regardless of the editing, someone who doesn't want to enter a number (or doesn't have one) will find ways around the edits.
For example, (303) 555-1212 (at one point in the past - Denver's directory assistance) is one I often use.
Or sometimes, I'll flip over to the website's contact page and copy one of their own phone numbers.
Also make sure that there is absolutely no chance of anyone needing to enter a phone number that doesn't follow the North American Numbering Plan (NANP).
There are too many websites that edit the phone based on NANP format regardless of the country which has been given.
Cheers