How can I create a validation rule that prohibits a user from saving a value in a phone number field if it has any character other than a number [0-9], a hyphen (-), or a parenthesis (())?
Similar examples I've seen have said that REGEX() is the way to go, but I don't want to restrict the value to be a certain length, not do I want the user to be forced to have a hyphen or parenthesis at a specific location. All of the following should be acceptable (not exhaustive):
- 1(999)999-9999
- 1(999)9999999
- (999)999-9999
- 9999999999
- 999-9999
4 件の回答
Hi Aaron, Please try the below
AND(
NOT(ISBLANK(Phone)),
NOT(REGEX(Phone, "[0-9()-]+"))
)