• Bharath Goud 10
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi All, 

I'm currently trying to use a REGEX operator in a formula field. This is my code : 

IF(
  OR(
    REGEX((SUBSTITUTE(Contact_Phone__c," ","")), "[0-9]{12}"),
    REGEX((SUBSTITUTE(Contact_Phone__c," ","")), "[0-9]{11}")
    ),
  SUBSTITUTE(Contact_Phone__c," ",""),
  ""
  )

This is the error I get : Function REGEX may not be used in this type of formula (Related field: Formula)

But on the documentation page (https://help.salesforce.com/articleView?id=customize_functions_i_z.htm&type=5) it seems like I can use REGEX in a formula field. 

Many thanks for any explanation !