Regular expression with new line

Hi
I have a file:
1
a
2
b

I want
1a
2b

How to do this with a regular expression?
I tried Find: “^([0-9])$” Replace: “$1”
It find the right strings, but the new line/paragraph remains after replace.

Thanks

Not sure where you are trying to do this. If it in Writer take a look at Alternative Find & Replace for Writer extension and see it it helps

Without any clue about the “real” content of your file it is impossible to suggest any solution.

What are the separators between your “lines”? Line breaks (Shift+Enter) pr paragraph breaks (Enter? These are fundamentally different.

Built-in Edit>Find & Replace has its scope limited to one paragraph (between paragraph marks). Consequently, it can’t merge separate paragraphs.

What do you want to achieve (from a typographical point of view)? A numbered list? If so, there are better ways.

Please, when asking here, always mention OS name, LO version and save format.

You can get some hints in a few related answers.

Thanks, useful tips!
In the end I exported to raw txt, and did it there.

(The reason I wanted to do this was because it was an imported text file)

Then if it was a text file, don’t “pollute” it by importing it into Writer. Writer is a sophisticated document processor and therefore “enriches” text with various “annotations”. Thus, you lose the initial structure, simplicity and regularity of your initial contents.

1 Like