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
Giancarlo AmatiGiancarlo Amati 

Pattern matching validation rules

Dear All,

we have just released a new naming convention for our contract names. We have a "Contract ID" field in the opportunity which is a text. 
How can I make sure that the text matches a certain pattern? For example, the convention we have set is:

6LettersAccount-date - Customer FULL NAME - Product name

So the three parts are separated by a dash. Is there something in salesforce that can help me to do some Patter Matching with Validation Rules? 

Thank you.
Devi ChandrikaDevi Chandrika (Salesforce Developers) 
Hi Giancario,
You can use regex function in validation rule formula for this.Regex is a function used in validation rules to validate  format of the data should be entered.
Regex Compares a text field to a regular expression and returns TRUE if there is a match. Otherwise, it returns FALSE. A regular expression is a string used to describe a format of a string according to certain syntax rules.

Please refer below link which might help you in this
https://help.salesforce.com/articleView?id=000334073&type=1&mode=1 (https://help.salesforce.com/articleView?id=000334073&type=1&mode=1)
https://help.salesforce.com/articleView?id=customize_functions_i_z.htm&type=5 (https://help.salesforce.com/articleView?id=customize_functions_i_z.htm&type=5)

Hope this helps you
Let me know if this helps you. Kindly mark it as solved so that it may help others in future.

Thanks and Regards