Issue 81096 - Find&Replace: "Replace All" with Regular Expressions $ and \n fails
Summary: Find&Replace: "Replace All" with Regular Expressions $ and \n fails
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: editing (show other issues)
Version: OOo 2.2.1
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: stefan.baltzer
QA Contact: issues@sw
URL:
Keywords: oooqa
Depends on:
Blocks:
 
Reported: 2007-08-28 18:21 UTC by enielsen
Modified: 2013-08-07 14:42 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Test file to demonstrate issue 81096 (6.54 KB, application/vnd.sun.xml.writer)
2007-08-28 18:32 UTC, enielsen
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description enielsen 2007-08-28 18:21:37 UTC
Replacing all line ends with newline followed by space (or newline preceded by
space) produces the wrong results.
Comment 1 enielsen 2007-08-28 18:30:31 UTC
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").
Comment 2 enielsen 2007-08-28 18:32:41 UTC
Created attachment 47826 [details]
Test file to demonstrate issue 81096
Comment 3 mike_hall 2007-08-28 20:13:18 UTC
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.
Comment 4 michael.ruess 2007-08-29 06:17:36 UTC
Reassigned to SBA.
Comment 5 stefan.baltzer 2007-09-20 10:33:59 UTC
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.
Comment 6 drking 2007-10-29 18:40:32 UTC
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
Comment 7 Oliver Specht 2007-10-30 10:06:20 UTC
Reassigned to ama
Comment 8 andreas.martens 2007-11-01 13:27:27 UTC
Will be fixed in CWS regexp02 for OOo2.4
Comment 9 andreas.martens 2007-11-09 08:05:41 UTC
Fixed in CWS regexp02.
Comment 10 andreas.martens 2007-11-09 16:18:06 UTC
Ready for QA.
Comment 11 stefan.baltzer 2007-11-26 13:19:35 UTC
SBA: Verified in CWS regexp02.
Comment 12 stefan.baltzer 2008-03-25 22:15:36 UTC
OK in OOH680m12. Closed.