function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sathis Kumar 12Sathis Kumar 12 

Rule

HI,

Can anyone tell how to write validation rule for below format.

Ex : +91 (123) 456 7890
Best Answer chosen by Sathis Kumar 12
Vijay NagarathinamVijay Nagarathinam
Hi Sathis,

Use the below validation rule, It will work.
 
NOT(
AND( (LEN(Mobile__c)==16 ),(REGEX(Mobile__c,'[+91]{3}-[7-9]{1}[0-9]{2}-[0-9]{3}-[0-9]{4}')))
)

Let me know if you need any help regarding this.

Thanks,
Vijay

All Answers

Vijay NagarathinamVijay Nagarathinam
Hi Sathis,

Use the below validation rule, It will work.
 
NOT(
AND( (LEN(Mobile__c)==16 ),(REGEX(Mobile__c,'[+91]{3}-[7-9]{1}[0-9]{2}-[0-9]{3}-[0-9]{4}')))
)

Let me know if you need any help regarding this.

Thanks,
Vijay
This was selected as the best answer
Sathis Kumar 12Sathis Kumar 12
Thanks Vijay!!
Vijay NagarathinamVijay Nagarathinam
Hi,

If its working, please choose as best answer, it will helpful for others,

Thanks,
Vijay