Bug 145806 - Backreferences inserted as literal text in regex replace if target contains comment
Summary: Backreferences inserted as literal text in regex replace if target contains c...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Find&Replace-Regex
  Show dependency treegraph
 
Reported: 2021-11-21 07:05 UTC by Seán Ó Séaghdha
Modified: 2023-12-07 03:36 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Simple test document (10.27 KB, application/vnd.oasis.opendocument.text)
2021-11-21 07:06 UTC, Seán Ó Séaghdha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Seán Ó Séaghdha 2021-11-21 07:05:37 UTC
Description:
When the target of a regex replace contains a comment, the literal text of the replace field is inserted instead of the backreferences, i.e. “$1  $2” is inserted instead of the text found.

Steps to Reproduce:
1. Start with a document containing sentences ending with a full stop followed by a single space
2. Search & Replace with regex (+ case matching)
   Search:
   ([.?!]|\.”|\?”|!”) ([A-Z]|“|‘)
   Replace:
   $1  $2


Actual Results:
If the match contains a comment, the text “$1  $2” is inserted instead of the backreferences to the matched text.

Expected Results:
The backreferenced text should be inserted (including the comment) as it is with matches that don’t contain a comment.


Reproducible: Always


User Profile Reset: No


OpenGL enabled: Yes

Additional Info:
Version: 7.2.2.2 / LibreOffice Community
Build ID: 20(Build:2)
CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: ga-IE (ga_IE.UTF-8); UI: ga-IE
7.2.2-2
Calc: threaded
Comment 1 Seán Ó Séaghdha 2021-11-21 07:06:24 UTC
Created attachment 176391 [details]
Simple test document
Comment 2 Michael Warner 2021-12-06 14:02:03 UTC
Repro in:

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: e9332dcdc8f2ea268d1b17c73d43a8834cf75365
CPU threads: 10; OS: Mac OS X 12.0.1; UI render: Skia/Metal; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 3 QA Administrators 2023-12-07 03:18:01 UTC Comment hidden (obsolete)
Comment 4 Seán Ó Séaghdha 2023-12-07 03:36:39 UTC
Bug is still present in 

Version: 7.6.3.2 (X86_64) / LibreOffice Community
Build ID: 60(Build:2)
CPU threads: 8; OS: Linux 6.6; UI render: default; VCL: gtk3
Locale: ga-IE (ga_IE.UTF-8); UI: ga-IE
7.6.3-2
Calc: threaded