Created attachment 167989 [details] Documetn where we're attempting to find & replace signature lines. Find when searching for regular expressions with new lines doesn't work. ref:https://help.libreoffice.org/6.2/en-US/text/shared/01/02100001.html # Testcase - Ctrl+H - find: `__________________________\nDemo Author` - [x] Regular Expressions - click `Find All` Expected result: Highlights: ``` __________________________ Demo Author ``` Actual result: Warning icon shows up in the find box. # Testcase 2 - Ctrl+H - find: `__________________________\pDemo Author` - [x] Regular Expressions - click `Find All` Expected result: Highlights: ``` __________________________ Demo Author ``` Actual result: Warning icon shows up in the find box. # Testcase 3 - Ctrl+H - find: `__________________________\pDemo Author` - [x] Regular Expressions - click `Find All` Expected result: Highlights: ``` __________________________ Demo Author ``` Actual result: Warning icon shows up in the find box. # Testcase 4 - Select the text ``` __________________________ Demo Author ``` - ctrl + c - ctrl + h - ctrl + v - find:`__________________________ Demo Author ` - please note where there are new lines it's actually displaying an arrow that points to the left, similar to what you'll see on the enter key. - [ ] Regular expressions - click `Find All` Expected result: Highlights: ``` __________________________ Demo Author ``` Actual result: Warning icon shows up in the find box. Suggested action either add a dialog that's something like this https://bugs.documentfoundation.org/show_bug.cgi?id=38261 or add a "multi-line" checkbox under the sign input and make the regex greedy/non-greedy to fix it. The desired end result is to do this in python. The code below works as expected. `\n` isn't finding new lines or paragraph breaks. ``` replace = document.createReplaceDescriptor() replace.SearchRegularExpression = True replace.SearchString = r"Pre\-Authorized\*\*\*\*(Pre\-Authorized[ \*]+)+\*\*\*Pre\-Authorized" replace.ReplaceString = r"" document.replaceAll(replace) ```
This code however doesn't notice the `\n` at the end. ``` replace = document.createReplaceDescriptor() replace.SearchRegularExpression = True replace.SearchString = r"Pre\-Authorized\*\*\*\*(Pre\-Authorized[ \*]+)+\*\*\*Pre\-Authorized\n" replace.ReplaceString = r"" document.replaceAll(replace) ```
(In reply to Eugene Miller from comment #0) > > Find when searching for regular expressions with new lines doesn't work. > ref:https://help.libreoffice.org/6.2/en-US/text/shared/01/02100001.html > and this documentatioh states: \n in the Find text box stands for a line break that was inserted with the Shift+Enter key combination and the provided sample document finalizes the line with a paragraph mark. From my perspective: Not a bug, but documented behavior.
Ok, so the bug I'm dealing with isn't this. You can close this if you like. There are multiple testcases that are actually different bugs. The issue is other things that are coming into play that makes it harder to understand what's going on. I mean you have to read the documentation to understand that there really isn't a way to search across 2 paragraph markers and if there is it's not documented. - Copy/paste into the "find" converts paragraph ends into shift+enter new lines. - There doesn't seem to be an easy way to find paragraph ends & paragraph beginnings. `^._[_]+\pDemo` works in the "Alt Find & Replace" extension but won't here.
*** This bug has been marked as a duplicate of bug 108256 ***