vessillo / foxreplace

Automatically exported from code.google.com/p/foxreplace
0 stars 0 forks source link

regexp newline in output #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. use \n in "with" of "Substitutions" box
2.
3.

What is the expected output? What do you see instead?

I get \n instead of a newline

What version of the product are you using? On what operating system?
0.10.0 (linux, firefox 2.0.0.15)

Please provide any additional information below.

sorry, didn't know how else to contact you but foxreplace is my most used
add-on and for what I do is completely indispensable so "thank you!!" so much.

this is really a question, not an issue - what do I need to use in the
"with" box (for "replace ... with") to produce a newline in the output? 
for "Replace" I use "RE regular expression".

for example I want to replace 

"xxy" with 

"this is a line
replacing something 
so stuff will go in here"

when I use "this is a line\nreplacing something\nso stuff..." I just get
that same line in the output, no new lines:

"this is a line\nreplacing something\nso ..." 

hope my question is clear :)  incidentally all the quotes are just to
demarcate the text I'm referring to, not for inclusion in the "with" or
"replace"

Original issue reported on code.google.com by ssehsem...@mailinator.com on 14 Jun 2009 at 5:58

GoogleCodeExporter commented 9 years ago
> What do I need to use in the "with" box (for "replace ... with") to produce a
newline in the output?
As with most things, the answer is "It depends" ;)

- If you are replacing plain text (or text in a <textarea> or <pre> in an HTML) 
what
you would have to do is put a newline character (ASCII 10) in the output 
("with")
field. You can do this only if you use the substitution list because you can 
import
an XML file with the newlines in the substitutions.

- If you are replacing text in a webpage but the HTML checkbox is unchecked, 
then
it's currently impossible with FoxReplace (to get a visible line break you 
would have
to insert a <br>, because a simple newline is displayed as a space).

- If you are replacing the source code of a webpage (HTML checkbox checked), 
then you
can put <br> or <br/> to create the newline.

I have to address the first case so it is easier to add a newline in plain text 
(for
example with \n). The second case is more complex, but I am thinking of it.

Original comment by marc.r...@gmail.com on 15 Jun 2009 at 11:02

GoogleCodeExporter commented 9 years ago
hi -

thank you.  it is the first item (replacing plain text in a text area using 
"with" in
"Substitutions" section; "URLs" section is empty/unused) - but I can't figure 
out how
to enter ASCII 0x0A in the "with" box.  

I use linux so can't use the windows alt-nm trick (don't use gnome or kde) but 
have
tried "
", "
", "#0D", "#0A", and a couple other variants but I always get the
code in the replacement line, no line breaks.

I've tried each with all 3 "Replace" types.

Original comment by ssehsem...@mailinator.com on 20 Jun 2009 at 5:39

GoogleCodeExporter commented 9 years ago
Hi,

Yes, you can't enter the newline in the textbox, the only way is via the import
feature. For example, you create your substitutions with the editor (without the
newlines), then you export the substitution list; then you open the XML file 
with a
text editor and insert the newlines* where you want, save the file, and then 
import
it as the new substitution list. This is the only way to do it as of now, but I 
will
fix this for the next version (0.12.0) so it can be done without 
exporting/importing.
But also, the next version will be compatible only with Firefox 3+ because of 
this:
https://developer.mozilla.org/en/Working_with_windows_in_chrome_code#Using_JavaS
cript_code_modules

* You have to do the newlines as literal newlines, for example:
  ...
  <output>"asdf
1234"</output>
  ...

Original comment by marc.r...@gmail.com on 21 Jun 2009 at 11:09

GoogleCodeExporter commented 9 years ago
sorry, misread what you were saying in the relevant example but I understand 
now.

Original comment by ssehsem...@mailinator.com on 21 Jun 2009 at 4:45

GoogleCodeExporter commented 9 years ago
Version 0.12.0 is already released (in the sandbox) and it's easier to write 
newlines
and some other especial characters.

Original comment by marc.r...@gmail.com on 22 Jul 2009 at 5:26

GoogleCodeExporter commented 9 years ago
tyvm, I'm going to try it out (upgraded to ffox3 partly for foxreplace :))

Original comment by ssehsem...@mailinator.com on 22 Jul 2009 at 7:43