Issue 124521 - Find & replace all with references gives wrong result
Summary: Find & replace all with references gives wrong result
Status: CLOSED DUPLICATE of issue 107619
Alias: None
Product: Calc
Classification: Application
Component: editing (show other issues)
Version: 4.0.1
Hardware: All All
: P3 Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on: 107619
Blocks:
  Show dependency tree
 
Reported: 2014-03-26 16:01 UTC by Joe Smith
Modified: 2017-05-20 09:53 UTC (History)
2 users (show)

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


Attachments
Screen captures showing results as described (72.76 KB, image/png)
2014-03-26 18:23 UTC, Joe Smith
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Joe Smith 2014-03-26 16:01:20 UTC
Testing AOO 4.0.1 on Fedora Linux 17

Steps to reproduce:
1) File > New > Spreadsheet
2) Cell A1, enter: s1:A s2:B s3:C
3) Edit > Find & Replace:
   Search for: s(\d+):
   Replace with: $1)
   Options/Regular expression: ON

   Click "Replace all"

Expected result: 1)A 2)B 3)C

Actual result: 1)A ))B ))C

This may be the same as (or related to) the problem reported in bug 107619

The same operation works correctly in AOO Writer.
Comment 1 j.nitschke 2014-03-26 17:47:11 UTC
correction of initial report
actual result is: s1)A s1)B s1)C

so same behavior as described in bug 107619, comment 0 first example

after first replace the match isn't updated for the next replacement so the
first match is always used as replacement

*** This issue has been marked as a duplicate of issue 107619 ***
Comment 2 Joe Smith 2014-03-26 18:22:46 UTC
That's not the result I get; that's why I filed a new report.

See attached screen shots.
Comment 3 Joe Smith 2014-03-26 18:23:52 UTC
Created attachment 82995 [details]
Screen captures showing results as described
Comment 4 Joe Smith 2014-03-26 18:27:00 UTC
It'a clearly a similar problem here, but the exact behavior is different from the earlier issue.

I'm done here. Set the status however you think best.
Comment 5 j.nitschke 2014-03-26 20:18:47 UTC
(In reply to Joe Smith from comment #2)
> That's not the result I get; that's why I filed a new report.
> 
> See attached screen shots.

yes apologies, I had the parenthesis wrong "(s\d+):" not "s(\d+):"

somehow for the second and following hits the last char of the match is replaced by the second char in the replacement string

Cell: s1:A s2:B s3:C
search string: s(\d+):

replacement string: $1) -> result: 1)A ))B ))C
replacement string: $1x) -> result: 1x)A xx)B xx)C
replacement string: x$1) -> result: x1)A x1)B x1)C  (see bug 107619)

Cell: s11:A s22:B s33:C
replacement string: $1) -> result: 11)A 1))B 1))C (bug 107619 needs to be fixed first before we can fix this result)
Comment 6 hanya 2015-01-22 17:58:19 UTC
From my observation, this problem is duplicate of issue 107619. 
The group reference in the replace string is not updated while the repeat search inside the cell by search all function.

*** This issue has been marked as a duplicate of issue 107619 ***