Bug 130480 - search for regular expressions not usable any more
Summary: search for regular expressions not usable any more
Status: CLOSED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.2.8.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Find&Replace-Regex
  Show dependency treegraph
 
Reported: 2020-02-06 09:34 UTC by Karsten
Modified: 2023-02-19 04:28 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten 2020-02-06 09:34:46 UTC
Description:
In older versions of Libreoffice the search and replace in Writer could be a mighty tool to clean up text.
But now it has a complete new syntax and is working so bad that it is not usable any more.

As example i want to clean a text from the page numbers. Something like
¶
¶
3¶
¶
¶

The expectation is to search for ^$^$^([:digit:]+)$^$^$ and replace it with nothing. But this does not work!

The only thing that is working to replace the side number with ^([:digit:]+)$
But then it is not possible to replace multiple empty lines.

^$^$ is not working!

^${2} is not working!

^${2,5} is not working!

So this engine is only usable for silly things ...

Steps to Reproduce:
Make a text with standalone page numbers like

¶
¶
3¶
¶
¶

Try to delete them with ^$^$^([:digit:]+)$^$^$

Actual Results:
Does not work

Expected Results:
Normal functionality of an regular expression engine


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.2.8.2
Build-ID: f82ddfca21ebc1e222a662a32b25c0c9d20169ee
CPU-Threads: 4; BS: Linux 3.16; UI-Render: Standard; VCL: kde4; 
Gebietsschema: de-DE (de_DE.UTF-8); UI-Sprache: de-DE
Calc: CL
Comment 1 Dieter 2020-02-06 18:38:05 UTC
Karsten, thank you for reporting the bug. Could you please try to reproduce it with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ or at least with the actual stable version? Thanks. I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the latest version. Change to RESOLVED WORKSFORME, if the problem went away.
Comment 2 Karsten 2020-02-07 10:55:54 UTC
I can try to install it.

What's about the suggested Regex in your development version?

Why it was possible to work it in the history?

In the history \n stands for carriage return and not for a blank line.
Why this standards have been altered?
Comment 3 V Stuart Foote 2020-02-07 18:18:01 UTC
Project uses the ICU lib regex [1], where "^$" is not explicitly defined syntax.

But think changes for multiline matching came in at 6.1 with
https://gerrit.libreoffice.org/c/core/+/49387

@Justin, Eike?

=-ref-=
[1] http://userguide.icu-project.org/strings/regexp
Comment 4 Eike Rathke 2020-02-10 12:35:30 UTC
It was never possible to search for multiple empty paragraphs with ^$^$
One empty paragraph can be matched with ^$, which anchors an otherwise empty expression to start and end, and is explicitly handled in Writer sw/source/core/crsr/findtxt.cxx FindTextImpl() with bool bChkEmptyPara = ... used in the DoSearch() call.

You'll probably also find no regular expression engine that would support
^$^$^([:digit:]+)$^$^$
in the here intended way. Try at https://regex101.com/

The \n also never matched an end of paragraph, but a newline entered with Shift+Enter, and still does.
See https://help.libreoffice.org/6.4/en-US/text/shared/01/02100001.html for details.
Comment 5 Karsten 2020-02-10 13:09:28 UTC
Yes - not with ^$^$ but with \n\n when i remember correct.
I promise it was the time of Libreoffice 5.

It was the time the screen rendering was better too.
Why changing things that works better in the history?
Please - this should not be an attack - just a question to think about.
Comment 6 Eike Rathke 2020-02-10 13:47:06 UTC
Also \n\n never worked as an empty paragraphs match, only matching multiple empty lines, i.e. newline entered with Shift+Enter.
Just tried with LibreOffice 5.3.7 and even OpenOffice.org 3.3.0
Comment 7 Eike Rathke 2020-02-10 13:49:16 UTC
Closing.
Comment 8 Justin L 2020-02-10 14:24:22 UTC
Perhaps you were using an extension. A google search indicates that "Alternative dialog Find & Replace for Writer" works very nicely for just this sort of task.

https://ask.libreoffice.org/en/question/20265/how-to-replace-multiple-paragraph-markers/
Comment 9 Karsten 2020-02-10 14:46:57 UTC
Then this extension will be the solution.
Thank you.