Substitute for .replace

win b
Mega Guru

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.

find_real_file.png

 

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 SIfind_real_file.png

iis it possible to replace it all or is there a .replaceall command for me to replace the duplicate assigned values?

 

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

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!

View solution in original post

5 REPLIES 5

Allen Andreas
Administrator
Administrator

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!

You know, for some reason I though replaceAll() didn't work server-side!

I've been doing it the hard way for far too long. 

Thanks Allen!

Michael Jones - Proud member of the GlideFast Consulting Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Hi,

Haha, honestly, I didn't think we could use it either (I thought it may have been ES6) and I was screen sharing and someone was like...why don't you use replaceAll and so I tested it, just to see, and sure enough it worked.

Previously, I was using what I thought was the hard way, which was:

replace(/searchterm/g, string)

So a global replace, which does the same as replaceAll(), but the longer way.

Please mark reply as Helpful, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

thank you very much for the help it works on my end