• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

Text / Number formatter function

I have a requirement where I need to extract all the digits (only) from the input field's value while removing all spaces, signs, hyphens, emojis, etc. For example:

Input field value:
77 33 00 - 2013 🦢
77 33 00 - 3882
77 33 00 - 4013 Sold
*_77 33 88 - 1522
77 33 88 - 1987 🦢

The expected result should be:
7733002013
7733003882
7733004013
7733881522
7733881987

Could you please assist me in achieving this with Pabbly Connect? Any guidance or instructions would be highly appreciated.
 
P

Pabblymember11

Guest
Hey @deepak9780097800

You can make use of the "Code" action step to convert the phone number into a simple phone number.

function extractDigits(input) { // Remove spaces, signs, hyphens, emojis, and other non-digit characters const cleanedInput = input.replace(/[^\d]/g, ''); return cleanedInput; } const inputFieldValues = [ "77 33 00 - 2013 🦢" ]; const results = inputFieldValues.map(value => extractDigits(value)); console.log(results);

2023-08-08_16h58_34.png
 
Top