I have created a custom text field (Text01__c).

I need a way of allowing ONLY the characters [a-z][A-Z] and space.

Can someone help me with either a formula or workflow rule to prevent this text field from saving with any other characters?

Thanks, Ramesh

  • What is your question? 'Any formula for validation rule or workflow rule'? – Gaurav Kheterpal Dec 31 '13 at 7:17

Use the below validation rule

NOT(REGEX( Text01__c, "[a-zA-Z ]*$"))

  • Thank it working fine.It not allows any special characters. – Ramesh S Dec 31 '13 at 9:37
  • 1
    I hope this is the functionality you want – Shebin Mathew Dec 31 '13 at 9:59
  • 1
    Or, NOT(REGEX(Text01__c, "^(\\w\\s)*$")) if you want to allow other "word" characters, such as "ñ", which would be common in Spanish words. – sfdcfox Dec 31 '13 at 15:40

You can try below regular expression

  • 2
    Hi Ajay. Welcome to SF.SE. You may not be aware, but you've posted a reply to a 1-1/2 y.o. question that has an accepted answer. Further, your answer is incomplete and provides a regular expression that wouldn't work with Salesforce validation rules. I recommend you visit our Help center to learn how this forum works before posting further. – crmprogdev Aug 9 '15 at 17:43

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.