Skip to main content

Going round in circles with this - how can I format a mobile number in format ########## to Aust format ####[space]###[space]###?

I’m on a Pro plan.

 

Hi ​@Publicity Princess 

Try this Zap action: Formatter > Numbers > Format Phone Number

 

Otherwise, you can use a Code step:

const phone = inputData.phone;

// Ensure the input is a string and remove non-numeric characters
const cleaned = phone.toString().replace(/\D/g, '');

// Check if it's exactly 10 digits
if (cleaned.length === 10) {
const formatted = cleaned.replace(/(\d{4})(\d{3})(\d{3})/, '$1 $2 $3');
output = { formatted_phone: formatted };
} else {
output = { error: 'Invalid phone number format' };
}

 


Hi there, ​@Publicity Princess 👋

How did you get on with that Formatter action Troy suggested? Did it do the trick or did you go with the Code step instead? 

Let us know if you have any questions or need some more help—want to make sure you’re all set! 🙂


Thanks for the suggestions Troy but I can’t get either of them to work and so have reverted back to manually adding the spaces to the phone number.

It may be an error at my end but I simply don’t have any more time to spend on this right now. 😕


Hi ​@Publicity Princess 

We completely understand! If you ever want to revisit it, We’d be happy to take another look and troubleshoot with you. In the meantime, if manually adding spaces works for now, that’s totally fine.

Let us know if there’s anything else I can help with! 😊