Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Scrub Junk from Phone Numbers



So basically we have a form that users fill out and based on what they pick in the form, it texts different members in the company. We list the groups we want to text inside Excel, then based on what they pick in the form, it loops through the group IDs in Excel and pulls members from 365. Pulls their numbers from 365 and loops through each member to text them via Twillio.


This is all working perfectly but the issue is that if a number has formatting in it, it breaks. So the numbers have to be formatted 12345677878 instead of like (234) 567-7878. What's the easiest way to scrub the special characters from numbers before it passes it to Twillio? Right now we're trying to make sure every number we put into 365 is formatted without the characters but this isn't ideal. We would want it to look for parenthesis, periods, spaces, etc. The other challenge is that it has to begin with a country code (1).


Thanks for the help!


text groups.jpg

Super User
Super User

Hi @KuhnsKC 


You can try a nested replace function expression like : 
replace(replace(replace(replace(variables('Number'),')',''),'(',''),' ',''),'-','')


If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (99,006)