Ask Search:
Chris JohnsChris Johns 

Validation rules to format text

Hi,

I have a feild for medicare number and i want this to do a couple of things the field should only take 10 numbers however when the team enter the information i would like it to be formated as


#### ##### #

How can i achieve this?

Thanks
Best Answer chosen by Chris Johns
Sunil SarillaSunil Sarilla
Hi Chris,
Create a Validation rule as below to ensure the reps always follow the same pattern when entering the medicare number
AND(
NOT(ISBLANK(Medicare_Number__c)),
NOT(REGEX( Medicare_Number__c , "[0-9]{4}\\s[0-9]{5}\\s[0-9]{1}"))
)
Please use the insert field button to select the field API Name of Meidcare number field.