• 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

REGEX and removing "

shane6836

Member
Hoping for someone to tell me what I am doing wrong - using Pabbly Code action with Javascript to pass arrays to Documentero for document generation.

Have tried everything I can think of, googled endlessly, no matter what i try, when the output generates, all the items in the Array still contain " around the text.

For example, the line of code is:
let IncomeDesc= IncomeText.replace(/[\[\]]/g, '').split(',');

The output from the Pabbly Code action is:
[{"IncomeDescription":"\"Income\"","IncomeOwner":"\"Jess Harris\"","IncomeAmount":"$443","IncomeFrequency":"\"Fortnightly\"","AnnualIncome":"$11,518"},{"IncomeDescription":"\"Income 1\"","IncomeOwner":"\"Shane Harris\"","IncomeAmount":"$100","IncomeFrequency":"\"Weekly\"","AnnualIncome":"$5,200"},{"IncomeDescription":"\"Income joint\"","IncomeOwner":"\"Shane Harris","IncomeAmount":"$100","IncomeFrequency":"\"Yearly\"","AnnualIncome":"$100"}]

This comes out into the end documents as:
"Income"
"Jess Harris"​
$443​
"Fortnightly"​
$11,518​

Interestingly, the only outputs that are not wrapped in " are currency outputs that have been handled through the following internal function:
const formatCurrency = (number, symbol = '$') => {
const formattedNumber = number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return `${symbol}${formattedNumber}`;
};

Have tried to use the replace info from this without luck (I am not great with regex at all, but feel like i should be able to figure this out)
 

Similar threads

P
Replies
0
Views
4K
PabblyMember3
P
Top