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
Michael Sabel 9Michael Sabel 9 

Trying to get validation rule right that excludes commas and periods from street address fields

So, I want to make sure that user can't type "St." for Street and must type "St" instead. And, that user can't type "Suite, 4" and must type "Suite 4".
So, no commas "," or periods ".". 

Here's what I've tried. Not working because I think what I've done here is allow for commas and periods when I'm trying to exclude them. Not sure how to exclude them.
AND(
NOT(ISBLANK(MailingStreet)),
NOT(REGEX( MailingStreet, "[a-zA-Z0-9\\.\\,]+"))
)

Thanks.
Best Answer chosen by Michael Sabel 9
Maharajan CMaharajan C
Simply try using the below one:

AND(
NOT(ISBLANK(MailingStreet)),
OR(
CONTAINS(MailingStreet , "."),
CONTAINS(MailingStreet, ",") ))

Thanks,
Maharajan.C

All Answers

Maharajan CMaharajan C
Simply try using the below one:

AND(
NOT(ISBLANK(MailingStreet)),
OR(
CONTAINS(MailingStreet , "."),
CONTAINS(MailingStreet, ",") ))

Thanks,
Maharajan.C
This was selected as the best answer
Michael Sabel 9Michael Sabel 9
That worked perfectly. Thanks.