REGEX and removing "

Status: Open · Asked by Shane Harris on · 0 views

shane6836 — Question ·

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:
[TABLE]
[TR]
[TD]"Income"[/TD]

[TD]"Jess Harris"[/TD]

[TD]$443[/TD]

[TD]"Fortnightly"[/TD]

[TD]$11,518[/TD]
[/TR]
[/TABLE]

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)

Arshil Ahmad — Reply ·

Hi @shane6836,

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

youtube.com/watch?v=oFvzL6iaDAI:164

shane6836 — Reply ·
Hi @shane6836,

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

youtube.com/watch?v=oFvzL6iaDAI:164


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!!
Preeti Paryani — Reply ·

Hello @shane6836

Thanks for the update, we'd love to hear your thoughts! If you have a moment, please rate us on Google. Your feedback helps us improve.

Thanks & Regards,
Preeti Paryani
Customer Support Associate
Pabbly.com

Back to all forum threads · Log in to reply