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

Validation Rule to check if a field contains specified characters

Hi All,


We have a requirement wherein a field can have any values between 0-9 or special characters comma,spaces,"+","-",";","/",".","(",")". Other than this a user should not be able to enter anything.


Need to write a custom validation rule for this. But not able to achieve the desired functionality. Please help me how to achieve it


Thanks in advance

Priya Nair

Steve :-/Steve :-/

Can you include the source code you are currently using?


It looks like either a 



CONTAINS(FieldName, "Text") or NOT(CONTAINS(FieldName, "Text")




Formula sholud get you what you are looking for . 

This looks like might be a good candidate for the REGEX function.  Check it out in Help and Training (Search on REGEX)and this is a useful reference for the function and constructs Regex reference.

Can you please elaborate on how the REGEX works? I want to validate that a field contains letters and numbers but not spaces or special characters.