+ Start a Discussion
Ladykb27Ladykb27 

Phone Validation / REGEX[

We have a number of problems with phone number entries, our contacts integrate with another system and we are having failures due to unseen characters being entered into phone numbers... these seem to happen when numbers are copy paste into salesforce.

 

The user cannot see them and is not aware, sometimes this can simply be a leading or trailing 'space'.. I want to add validation that will ensure numbers are added and cannot be saved with these present, Im wondering the best way to do it as there are so many different ways to enter a phone number, is there a REGEX for it? We mainly work on UK numbers but could have to add international. Thanks

SteveMo__cSteveMo__c

There are example of Phone Validation Rules including REGEX in the Formulas Guidebook.

https://na1.salesforce.com/help/doc/en/salesforce_useful_validation_formulas.pdf

abivenkatabivenkat

 

hi Ladykb27,

 

There is a international format for the phone numbers, ' LEFT(Phone, 1) <> "+" ' which cheks whether the country code followed by the plus sign is in front of the number or not and it may conflict with the ten digit rule.

@login.ax974@login.ax974

This could by handy as well to make sure that phone, fax, mobile they contain only numbers and follow the regular formatting of phone fields.

 

NOT( OR( ISBLANK(Fax), REGEX( Fax,"(\\D?[0-9]{3}\\D?)[\\s][0-9]{3}-[0-9]{4}")))