0

How can I create a Validation rule for Text field (Account Name) REGEX Format. Example Format: Raja Sekhar$9

closed as off-topic by Adrian Larson, Ratan Paul, Vigneshwaran G, superfell, Himanshu Aug 11 '16 at 17:20

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: SSCCE.org" – Adrian Larson, Ratan Paul, Vigneshwaran G, superfell, Himanshu
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Is that your whole post? What is the pattern that you want to enforce? – martin Aug 11 '16 at 12:32
1

If you look at the documentation, it explains quite well how to use the REGEX function:

REGEX

Description
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.

Use
REGEX(text, regex_text) and replace text with the text field, and regex_text with the regular expression you want to match.

So if you want to validate the Name field to disallow a string, it would look like:

REGEX(Name, '<expression>')
0

Hey @Raja Sekhar I will explain with you a sample example.so you can modify with your requirements.We have secuirty number in a custom object the format [xxx-xx-xxxx] like below.

NOT(OR(ISBLANK(Security_Number__c),REGEX( Security_Number__c , "[0-9]{3}-[0-9]
                 {2}-[0-9]{4}")))

Not the answer you're looking for? Browse other questions tagged or ask your own question.