Replace \n with Java script

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
harryandre31
Posts: 3
Joined: Wed Aug 22, 2018 1:59 am

Replace \n with Java script

Post by harryandre31 » Wed Aug 22, 2018 2:33 am

Code: Select all

column1 = 'I love you


to
';
i want replace /n (newbreak) in csv, then input.

Code: Select all

macro +=  "SET DESCRIPTION EVAL(\"var s=\\\"{{!COL1}}\\\"; s..replace(/\\n/g,'');\")" + "\n";
result

Code: Select all

__undefined__
help bro ^_^
chivracq
Posts: 8693
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Replace \n with Java script

Post by chivracq » Wed Aug 22, 2018 2:48 am

harryandre31 wrote:

Code: Select all

column1 = 'I love you

to
';
i want replace /n (newbreak) in csv, then input.

Code: Select all

macro +=  "SET DESCRIPTION EVAL(\"var s=\\\"{{!COL1}}\\\"; s..replace(/\\n/g,'');\")" + "\n";
result

Code: Select all

__undefined__
help bro ^_^
Yes...!, we definitely need more Romantics on the Forum...! :D

But, still applies to anyone for me to have a look, Romantics included...: :wink:
=> (F)CIM...! :mrgreen: (Read my Sig...)

But I already see a Typo in your 'EVAL()' with a 2x Dot in "s..replace()"...

And using 'EVAL()' in some on-the-fly Macro while you are already in a JS Env. is not the "Best Practice", ah-ah...! (You make it yourself very complicated and cumbersome with having to Double/Triple-escape Special Chars...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
harryandre31
Posts: 3
Joined: Wed Aug 22, 2018 1:59 am

Re: Replace \n with Java script

Post by harryandre31 » Wed Aug 22, 2018 12:01 pm

Oke bro i test
harryandre31
Posts: 3
Joined: Wed Aug 22, 2018 1:59 am

Re: Replace \n with Java script

Post by harryandre31 » Wed Aug 22, 2018 12:05 pm

chivracq wrote:
harryandre31 wrote:

Code: Select all

column1 = 'I love you

to
';
i want replace /n (newbreak) in csv, then input.

Code: Select all

macro +=  "SET DESCRIPTION EVAL(\"var s=\\\"{{!COL1}}\\\"; s..replace(/\\n/g,'');\")" + "\n";
result

Code: Select all

__undefined__
help bro ^_^
Yes...!, we definitely need more Romantics on the Forum...! :D

But, still applies to anyone for me to have a look, Romantics included...: :wink:
=> (F)CIM...! :mrgreen: (Read my Sig...)

But I already see a Typo in your 'EVAL()' with a 2x Dot in "s..replace()"...

And using 'EVAL()' in some on-the-fly Macro while you are already in a JS Env. is not the "Best Practice", ah-ah...! (You make it yourself very complicated and cumbersome with having to Double/Triple-escape Special Chars...)
i try again, error bro
Post Reply