[Libreoffice-bugs] [Bug 138752] New: regular expressions find with newline fails search

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Tue Dec 8 19:22:25 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=138752

            Bug ID: 138752
           Summary: regular expressions find with newline fails search
           Product: LibreOffice
           Version: 7.0.3.1 release
          Hardware: All
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: theerm at gmail.com

Created attachment 167989
  --> https://bugs.documentfoundation.org/attachment.cgi?id=167989&action=edit
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)
```

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20201208/976c1037/attachment.htm>


More information about the Libreoffice-bugs mailing list