Bug 139584 - \p should be added to the possible regular expressions for search and replace
Summary: \p should be added to the possible regular expressions for search and replace
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-13 12:02 UTC by Adalbert Hanßen
Modified: 2022-06-01 06:47 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Sample file for Bug 139584 (285.97 KB, application/vnd.oasis.opendocument.text)
2021-01-14 13:22 UTC, Adalbert Hanßen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adalbert Hanßen 2021-01-13 12:02:50 UTC
This proposal applies for all versions of LO Writer I have used so far. I just checked tis necessity with the current development version.

There is a very useful LibreOffice plugin called AltSearch.oxt. I frequently use it e.g. to replace paragraph marks (\p) by forced linefeeds (\n), protected spaces (\S) by normal spaces, remove all spaces before any paragraph mark and the like. But I still use AltSearch very often because with the normal Search/Replace mechanism, I can't search for paragraph marks and: AltSearch can search for styles, e.g. for [:::CharStyleName=Code(Zch)::].

Unfortunately AltSearch is very buggy and it happens over and over that it stops working even if it has worked for a long time in one and the same version of LibreOffice. Also it looks like the development of AltSearch has ended or fallen into hibernation: the current release 1.4.2 dates back to 2017-03-24 according to https://extensions.openoffice.org/de/project/alternative-dialog-find-replace-writer-altsearch.

Meanwhile LO Writer's Search/Replace has been equipped with the capability to search for and replace with special some regular expressions. Unfortunately paragraph mark (\p) – other than the line feed (\n) – is missing among those patterns and this is the one which is part of more than half of my searches. Search for \p it in file:///opt/libreofficedev7.2/help/de/text/shared/01/02100001.html?&DbPAR=WRITER&System=UNIX: you won't find it and try it, just to see if it was not only forgotten in the documentation: you won't find the next paragraph mark either.

Therefore as the first step, I propose to add the capability to LibreOfficeWriter to search for or replace with \p.
Comment 1 Mike Kaganski 2021-01-13 12:42:50 UTC
In LibreOffice, there are *no* paragraph marks (some kind of "character" that separates paragraphs). Paragraphs are separate objects, and there's no "character" between them.

However, https://help.libreoffice.org/latest/en-US/text/shared/01/02100001.html does include this:

> $ The end of a paragraph or cell. Special objects such as empty fields or
>   character-anchored frames at the end of a paragraph are ignored. Example:
>   "Peter$" matches only when the word "Peter" is the last word of a
>   paragraph, note "Peter" cannot be followed by a period.
> 
>   $ on its own matches the end of a paragraph. This way it is possible to
>   search and replace paragraph breaks.

So please make your request specific, without unrelated description of other benefits of other extensions (and without proposing specific names for the pattern, which might be different), just the use case that is not handled by *existing functionality* (I know there are such cases; just the request must be specific and short), like:

"In attachment X, I need to search for this (it may be a complex condition), and possibly replace with this; currently I only can do this like that using built-in means; if this proposal is implemented, this is simplified to this ..."
Comment 2 Adalbert Hanßen 2021-01-14 13:22:44 UTC
Created attachment 168881 [details]
Sample file for Bug 139584

Explanantion of inconsistent placeholders fpr paragraph marks and line breaks, playground to reproduce bugs.
Comment 3 Buovjaga 2021-12-01 15:55:31 UTC
(In reply to Adalbert Hanßen from comment #2)
> Created attachment 168881 [details]
> Sample file for Bug 139584
> 
> Explanantion of inconsistent placeholders fpr paragraph marks and line
> breaks, playground to reproduce bugs.

There are too many ideas here and no clear and concrete proposal for the original report description. Related to the original description, there are already

Meta Bug 38261 Better Find&Replace with regular expressions https://bugs.documentfoundation.org/showdependencytree.cgi?id=38261&hide_resolved=1
Bug 105109 - Search and Replace does not find empty paragraphs in textfile with CRLF line endings
Bug 31480 - Find/replace non-printing characters easily

Do you agree that the original idea is covered by the earlier reports?

This report could possibly be converted to be about some other topic from your essay document.
Comment 4 QA Administrators 2022-06-01 03:38:10 UTC Comment hidden (obsolete)
Comment 5 Adalbert Hanßen 2022-06-01 06:41:54 UTC
(In reply to QA Administrators from comment #4)
> Dear Adalbert Hanßen,
> 
> This bug has been in NEEDINFO status with no change for at least
> 6 months. ...

Quite some bug reports deal with deficiencies of Search&Replace and ask to integrate the capability of AltSearch into LO natively. There is a Meta bug report https://bugs.documentfoundation.org/show_bug.cgi?id=146076 to which I have added what I found out revisiting this bug.
Comment 6 Buovjaga 2022-06-01 06:47:43 UTC
(In reply to Adalbert Hanßen from comment #5)
> (In reply to QA Administrators from comment #4)
> > Dear Adalbert Hanßen,
> > 
> > This bug has been in NEEDINFO status with no change for at least
> > 6 months. ...
> 
> Quite some bug reports deal with deficiencies of Search&Replace and ask to
> integrate the capability of AltSearch into LO natively. There is a Meta bug
> report https://bugs.documentfoundation.org/show_bug.cgi?id=146076 to which I
> have added what I found out revisiting this bug.

Ok, that's not how meta bugs work, though. They collect individual reports. I assume this can be closed anyway.