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
Alex Christensen 1Alex Christensen 1 

Need help with an RGEX Validation Rule

I am trying to create a validation rule to prevent users from leaving first or last name blank or entering in anything aside from alphabetical values. The rule works however I need to allow for spacing. Can someone identify what I need to remove from the formula to allow for spacing? 

REGEX(FirstName, ".*([^a-zA-Z]+|\\s{2,}).*") || REGEX(LastName, ".*([^a-zA-Z]+|\\s{2,}).*")
AnkaiahAnkaiah (Salesforce Developers) 
Hi Alex,

Try the below formula will work.
OR(NOT(REGEX(FirstName,"^[a-zA-Z_ ]*$")),NOT(REGEX(LastName,"^[a-zA-Z_ ]*$")))

If this helps,Please mark it as best answer.

Thanks,
Ankaiah