Apache OpenOffice (AOO) Bugzilla – Issue 81096
Find&Replace: "Replace All" with Regular Expressions $ and \n fails
Last modified: 2013-08-07 14:42:49 UTC
Replacing all line ends with newline followed by space (or newline preceded by space) produces the wrong results.
To reproduce the problem: 1. Open the attached document "replacebug.odt" 2. Open the Find/Replace dialog (i.e. by CTRL-F) 3. Enter "$" (without the quotes) in the "Search for" box 4. Enter "\n " (without the quotes) in the "Replace with" box 5. Click the "More Options" button 6. Check the "Regular Expressions" checkbox 7. Click the "Replace All" button You will notice that there are two spaces preceding the letter "b" on the second line; there should only be one. You may repeat the process outlined above, but alter step 4 as follows: 4. Enter " \n" (without the quotes) in the "Replace with" box This time, after clicking the "Replace All" button, the first line will have two spaces following the letter "a" (there should only be one); the last line has no spaces (there should be one following "pab").
Created attachment 47826 [details] Test file to demonstrate issue 81096
Confirmed on XP with m680G_m2. First line with content (not an empty line) gets two replacements. Happens with other characters also, eg - and with multiple characters. Last line (at eof) gets no replacement.
Reassigned to SBA.
SBA: I tried OOo 2.1, 2.2.1 2.3 (OOG680m5). Following Steps 1-7 results in NO visible changes of the document. Only with Step 4 altered. the replace string being " \n" (including a space), there are two replacements in the FIRST line (while no replacement in the last line) every time "replace all" is clicked. This is not exactly a case from the average users daily life. Reassigned to OS.
I wonder if this has any connection to issue 77376, where the regex engine also seems to get confused about character positions at a paragraph break? Trying to help - sorry if it doesn't
Reassigned to ama
Will be fixed in CWS regexp02 for OOo2.4
Fixed in CWS regexp02.
Ready for QA.
SBA: Verified in CWS regexp02.
OK in OOH680m12. Closed.