0

I have a field text that cannot contain either l m or p whether it is upper or lower case. How can I accomplish this in a validation rule?

Please give examples. Perhaps a regular expression example or if there are functions that can be used

5

This regex formula will work in a validation rule:

REGEX(Field__c, ".*[lLmMpP].*")

It says the field can start with any character, contain the letters you don't want and then end with any character.

1

The regular expression would look like this: /[lmp]/gixm. Here's a very handy utility for determining regular expressions which is courtesy of GSkinner. You didn't say whether the field was rich text or not, so I've included flags that assumed it was.

Here's a link to Useful Validation Rules which should provide you with plenty of examples to help you figure out how to implement the rest of what you need. I know it contains some Regex examples.

  • It's a regular text field. – Thomas Riddler May 23 '14 at 13:46
  • If it's not multi-line, then you could drop the "m" and just use /[lmp]/gix. I highly recommend you try the links I gave you so you can play with the utility to learn how to do this yourself. – crmprogdev May 23 '14 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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