Skip to main content
Jenna Hill (Self Employed) 님이 #Validation Rule에 질문했습니다

I usually research and tweak examples I find to fit my needs, but in this case I'm struggling to understand how the REGEX function can be used to complete the task of disallowing any values outside of numbers, parentheses or hyphens in a phone number field.

 

I want users to be able to use parentheses or hyphens or "+" but not be required to. I also want users to enter numbers, but not specific amount of digits. I just don't want letters to be allowed.

 

Here's what I have so far: 

 

AND( NOT(ISBLANK(Phone)), (REGEX( Phone ,"^[0-9 + ( ) -]*$")) )

 

But it's throwing up errors when I enter "1234567" or "123-4567". What am I doing wrong? 

 

#Validation Rule #Formulas

답변 5개
  1. Tom Bassett (Vera Solutions) Forum Ambassador
    2021년 10월 14일 오후 4:44
    Have taken this from here https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A8TY1SAN

    REGEX(phone__c, "[0-9\(\)-]*")

0/9000