Skip to main content Stream TDX Bengaluru on Salesforce+. Start learning the critical skills you need to build and deploy trusted autonomous agents with Agentforce. Register for free.

Hi All,

 

I need to enforce the structure of mobile phone number fields, I am almost there but cant figure out how to allow for a special character at the start.

 

Example Accepted Formats

+61 402 123 123 || 0402 123 123

 

Rule so Far

AND( NOT(MobilePhone ="") , LEN(MobilePhone) > 0 , NOT(REGEX( MobilePhone ,"(^614[0-9]{2}(| )[0-9]{3}(| )[0-9]{3}$)|(^04[0-9]{2}(| )[0-9]{3}(| )[0-9]{3}$)")))

 

Any help would be greatly appreciated.

 

Thanks,

Brenden

 

@Formulas - Help, Tips and Tricks #REGEX #Validation Formula

3 件の回答
  1. 2021年8月31日 7:29

    Hi  Brenden ,

     

     Try this

     

    AND( 

    NOT(MobilePhone ="") ,

    LEN(MobilePhone) > 0 , 

    NOT(REGEX( MobilePhone ,"(^ [+] 614[0-9]{2}(| )[0-9]{3}(| )[0-9]{3}$)|(^04[0-9]{2}(| )[0-9]{3}(| )[0-9]{3}$)"))

  2. 2021年9月1日 0:49

    Hi  Brenden,

     

    It may be better to use ISBLANK.

     

    AND(

    NOT(ISBLANK(MobilePhone)) ,

    NOT(REGEX( MobilePhone ,"(^ [+] 614[0-9]{2}(| )[0-9]{3}(| )[0-9]{3}$)|(^04[0-9]{2}(| )[0-9]{3}(| )[0-9]{3}$)"))

    )

0/9000