- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 04:58 PM
Hi i would like to know that is there a code or substitute for .replace? I got a Script Include which generate a PDF but i got a problem encountered it only replace one declared value and doesnt replace the same second variable. What method should i use to replace it all? here is my example below.
I got a variable named watashi and qwerty were i place it in the first row and the last row in the table but the last row didnt display my blanked value but only brackets were the variable value should be place in. and here is my code in the SI
iis it possible to replace it all or is there a .replaceall command for me to replace the duplicate assigned values?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 05:49 PM
Hi,
You can certainly use:
replaceAll()
Which would remove the same term from the entire string. So if the string was 5 paragraphs long and you wanted to remove the word "and"...using just replace would remove the first one it finds, replaceAll would remove ALL instances of "and" from the string.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 05:51 PM
You could convert the string to a regular expression and do a global replacement. Something like this for example:
var text = 'qwerty';
var rep = new RegExp('\\' + text + '\\]', 'g')
html_body = html_body.replace(reg, current.variables.qwerty.getDisplayValue())
//rinse and repeat with each text value
I hope this helps!
If this was helpful, or correct, please be kind and mark the answer appropriately.
Michael Jones - Proud member of the GlideFast Consulting Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!