How do I insert line breaks in Writer with find & replace? [closed]

I've installed the extension mentioned elsewhere.... but I fail to see any instructions on how to make it actually find XXX and replace it with a line break. I've tried \n... that just enters a backslash and an 'n'.

Thanks

edit retag reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp close date 2016-02-19 04:07:01.374174

Sort by » oldest newest most voted

Assuming the extension is "Alternative Find & Replace", you'll need to check off "Regular expressions" if you manually enter \n or \p in the replace field. If you use the extension's built in replace drop down box it will (besides showing you the many options) automatically check off "Regular expressions" for you.

more

You can do this with CTRL-H search/replace without using the (excellent) AltSearch add-on. Exactly how depends on your OS (as you'll see), and you haven't mentioned your platform (Win? Mac? Linux flavour?). What you need to know is the method for input of ASCII values for your system. I'm on Linux Mint 13 (at the moment), and will use the key strokes that work for me.

So - to replace XXX with line-break (not paragraph break, which is easier!):

1. CTRL-H to bring up search/replace dialog; ensure that Other Options drop down is showing, and
[✓] Regular expressions ticked.
2. put your XXX sequence in the "Search for" box. If XXX is a whole word, you can ensure you only get it by entering the search this way: \<XXX\> (the slash-brackets ensure that your sequence starts and ends the whole word you're searching on).
3. to REPLACE this with soft-return (shows up as ↵ when you do CTRL-F10 to reveal non-printing characters), TYPE this sequence into the "Replace with" box: CTRL SHIFT U then 000A (three zero's followed by cap "A", NO SPACES). This (on my system) inputs ASCII Chr(10), the "line-feed" code. [This is the bit you'll need to adapt to your own operating system.]
4. Click "Replace all". Should put in your soft-returns throughout.

Variation: If you want to put that soft-return after XXX, then put an ampersand (&) in the "Replace with" box, immediately followed by the CTL-SH-U+000A code, as above.

Note: see also an earlier Q&A on some "find and replace" questions.

more

1

This IS the real answer! It is a pitty that LO doesn't have an easy way to support this. Another regex in the list would help.

( 2017-09-05 13:44:34 +0200 )edit