Replacing Characters in iMacros

lryan22

Newbie
Joined
May 27, 2017
Messages
19
Reaction score
2
I'm so close to completing what I need but I'm stumped. I'm trying to replace every comma in a string of text with nothing (deleting the commas). And after that, submit the edited string into a form. Below is the code I currently have. It works, but only the first comma is deleted, I need them all to go away.

Code:
VERSION BUILD=844 RECORDER=CR

SET !DATASOURCE C:\Users\Ryan\Desktop\data.txt

SET !VAR2 {{!COL4}}

SET !VAR2 EVAL("\"{{!VAR2}}\".replace(\",\",\"\");")

TAG POS=1 TYPE=INPUT:TEXT FORM=ID:masthead-search ATTR=ID:masthead-search-term CONTENT={{!VAR2}}
 
Someone helped me on the imacros forum :) Here is the solution:
Change line 7 to:
Code:
SET !VAR2 EVAL("\"{{!VAR2}}\".replace(/,/g, \"\");")
 
Back
Top