0

I need the flow to load a Phone number record into a custom setting without any dashes or parentheses. Ex. (440)-111-2222 into 4401112222. I am trying to use Regex to do this and not having any luck. Is there a better way to do this?

I have seen posts suggesting ideas like this,

REGEX( {!getOppRecord.Phone__c} , "[^|\\d]" )

in the value but I have not had any luck with it so far. enter image description here

  • why not just use SUBSTITUTE function and remove all special chars and spaces? – cropredy Nov 4 '19 at 18:42
  • Hi and thank you for the feedback crop, can I use the substitute function to remove the special characters? Would it something to the tune of: SUBSTITUTE({!getOppRecord.Phone__c}, "(", ""), ")", ""), " ", ""), "-", "") ? – Razvan Crisan Nov 4 '19 at 18:59
  • SUBSTITUTE(SUBSTITUTE(fld,'%',''),'^','') etc – cropredy Nov 4 '19 at 19:49
  • It looks like its not recognizing the function? Unless I am still doing something wrong. – Razvan Crisan Nov 4 '19 at 20:06
0

If you have a limited number of special characters to replace...

Assuming the field is called Phone__c

SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(
SUBSTITUTE(Phone__c,'-',NULL), 
'_',NULL),
'(',NULL),
')',NULL)

Removes hypen, underscore, left and right parens. Extend to other common characters like period/dot, plus sign, blanks, etc.

If I enter (650)555-1212 I will get back as the formula value 6505551212

You are only limited by the max compile size of the formula expression; REGEX only finds patterns, it doesn't do replacements (in a SFDC formula expression)

  • It looks like I am in fact hindered with an 80 - character limit on the formula. You formula contains 93 characters, and my field API name is also a little longer. Which is okay, I wanted to see what the capabilities were. – Razvan Crisan Nov 4 '19 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.