Bug 107916 - EDITING: Find & Replace Backreference Fails using Replace All and \b
Summary: EDITING: Find & Replace Backreference Fails using Replace All and \b
Status: RESOLVED DUPLICATE of bug 75806
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.2.6.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Find-Search
  Show dependency treegraph
 
Reported: 2017-05-17 16:56 UTC by Matthew Rink
Modified: 2019-12-19 09:45 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Rink 2017-05-17 16:56:42 UTC
In certain situations, using a regex with groups and backreferences in Find & Replace will cause the backreference to insert "$1" instead of the actual text.

Steps to Reproduce:
  In Writer:
    1.  In a document, insert the following text:
           .AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.
           .BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
           CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC.
           DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
    2.  In Find & Replace, use the following (with regex activated):
            Find: \b([0-9a-f]{32})\b
            Replace: $1
    3.  Note that hitting "Replace" will replace the strings of letters with themselves as expected.  Then note that hitting "Replace All" will replace the A and B strings with the text "$1".

Replace all results in Writer:
           .$1.
           .$1
           CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC.
           DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD

Libreoffice Calc performs the "Replace All" as expected:
           .AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.
           .BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
           CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC.
           DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
Comment 1 Jacques Guilleron 2017-05-19 08:45:36 UTC
Hi rink92,

I reproduce with
LO 5.2.6.2 Build ID: a3100ed2409ebf1c212f5048fbe377c281438fdc
Threads CPU : 2; Version de l'OS :Windows 6.1; UI Render : par défaut; 
Locale : fr-FR (fr_FR); Calc: CL
and
LO 5.4.0.0.alpha1+ Build ID: d89fa2bd4944625e2dbe56d5709a3f126db24f21
CPU threads: 2; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2017-05-18_07:09:13
Locale: fr-FR (fr_FR); Calc: CL

Thanks for the report.
Comment 2 QA Administrators 2018-05-20 02:33:29 UTC Comment hidden (obsolete)
Comment 3 Jacques Guilleron 2018-05-20 04:25:48 UTC
Still present with
lo 6.1.0.0.alpha1+ Build ID: 23c5125148a8110d88385b29570bf0b7d4400458
CPU threads: 2; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-05-12_00:15:25
Locale: fr-FR (fr_FR); Calc: CL
Comment 4 QA Administrators 2019-05-21 02:54:14 UTC Comment hidden (obsolete)
Comment 5 Mike Kaganski 2019-12-19 09:45:10 UTC

*** This bug has been marked as a duplicate of bug 75806 ***