• Instructions to Ask a Question

    For any assistance, please click the "Ask a Question" button and select the Pabbly product for which you require support.

    We offer seven comprehensive applications designed to help you efficiently manage and grow your business:

    Our support team endeavors to respond within 24 business hours (Monday to Friday, 10:00 AM to 6:00 PM IST). We appreciate your understanding and patience.

    🚀 Exclusive Lifetime Offers 🚀

    We invite you to take advantage of our special one-time payment plans, providing lifetime access to select applications:

    • 🔥 Pabbly Connect — Lifetime Access for $249View Offer
    • 🔥 Pabbly Subscription Billing — Lifetime Access for $249View Offer
    • 🔥 Pabbly Chatflow — Lifetime Access for $249View Offer

    Make a one-time investment and enjoy the advantages of robust business management tools for years to come.

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)
 

shane6836

Member
Hi @shane6836,

You can try using a Text Formatter to remove the double quotes from the output by replacing them with nothing.

The hours i spent trying to get that REXEX to work, when such a simple solution was right in front of me!!
Still took some fiddling (had to do two text formatter steps, one to replace "\" and one replace "\"" to " but is now working!!
 
Top