Find & Replace including a Paragraph Mark

I write macro’s in Word to refine OCR’d documents. a frequently used one is

Find: “, ^p” and Replace: ", " to join sentences which were split with the 1st half ending in a comma and space.

Now I have converted to Linux 100% (hooray!!!) and LibreOffice (hooray!!!) I am finding it very difficult to easily reproduce the same work-flow. I am no Regex aficionado but I have researched the “common Regular Expressions” wiki page plus several other forums etc, and find no really simple answer - seems a feature request is in order.

But before that assuming I missed something, do any of you have a really simple answer to this? I frequently want to include a Para mark in my search and/or replace. - I use \n in the Replace bit.
If I have to use a “U+code” how exactly is this typed in?

Many thanks

I think this extension can help:

This does do the job, so thanks for that. I will have to play around with this extension to find out why when I record a macro and use it, the extensions aspect is ignored. However, I notice it has its own batch commands and keyboard shortcut facility, so I think maybe they will replace the macros

Once you’ve installed the extension, how do you access the search dialog in Libre Office?

v4.1.5.3 OSX 10.9.2

A toolbar with a green binoculars icon is installed or in Menu/Edit/Alt. Find & Rep.

I had the same issue keeping me from Liberoffice. Now I can use it instead of XXXX. Hopefully they can add this to the main package!

Did you enable the Regular Expressions option?

Yes I have enabled the regular expressions option, of course. My reference to already using \n ought to have indicated that, sorry for not being clearer. I know I can search for \t, as I found that in my searches before asking my question.

In Word you can search for “, ^p” (i.e. comma, space, paragraph mark, no speech marks) and replace with ", " (comma, space, no paragraph mark) which will remove the paragraph mark. Simple, powerful and can be extended for all sorts of operations.

There appears to be no straight simple method of doing this in LibreOffice - there is no \p like the \t and \n etc.

I Know I can search “^$” and replace “” to remove empty paras, but my requirement is to remove just the para-mark depending on what I find immediately before it. Finding a comma or lower case letter immediately followed by the para-mark indicates a broken sentence, I want to test for that and remove the para-mark.

I know I can test for [a-z]$ etc, but I can’t find a way to just delete the end of Para mark when it finds them.

If you enable (tick) “Regular Expressions” in the find & replace box, the $ sign indicates a paragraph mark for searching.

Search: “, $”
Replace: ", "

The line-end character ($) can only be used in isolation and not in combination with other (literal) characters, in the default search / replace facility in v3.5 through v4.2 of LO.

It’s not a direct answer to your question, but have a look at the pair of answers on quotation marks (that one linked, and the one below it). One is about assiging macros to menus, etc., the other is about regex in relation to quotation marks.

In the latter post there is also a link to a discussion in an OpenOffice forum explaining the regex statements used which, I think, will help solve your own paragraph issue here. If I get a moment, I’ll have a stab at constructing one myself, but maybe that’s enough to get you going. (Give someone a fish…, teach someone to fish…, etc.!)

Search for [a-z]+$[a-z]+ (the + is for 1 or more occurence).

Now please someone do help with the “Replace with” part, as I’m having troubles myself trying to recall in the usual way \1, \2, ecc. the strings found with the search regexp…

And, moreover, the Alternate Find&Replace extension always throws a Basic Exception when I try to replace with “all text” &, and/or \1 \2 ecc…

Look for “regular expression” in the index tab of LibreOffice help, you can find what you are looking for?

It is not possible to perform a replace over a line-ending, using the default regular expression engine in LO. This engine also only appear to support a basic substitution (i.e., & representing the entire search expression) rather than enumerated capture groups (i.e., \1, \2, etc.)