Bug 161932

Summary: Replacing text in italics with regular expressions (.*?) changes the original italics
Product: LibreOffice Reporter: Daniele <grassode>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: UNCONFIRMED ---    
Severity: normal    
Priority: medium    
Version: 24.2.4.2 release   
Hardware: ARM   
OS: macOS (All)   
Whiteboard:
Crash report or crash signature: Regression By:
Attachments: Test file with results shown

Description Daniele 2024-07-06 17:03:43 UTC
Description:
When searching and replacing characters around a given string containing some italics, the $1 replacement option does not work as espected, that is, it changes which characters are in italics.
Expression used 
Search: (\x20*)([\-|—|–]|\-{1,})([\x20]*)(.*?)([\x20]*)([\-|—|–]|\-{1,})(\x20*)
Replace: –⁠ $4 ⁠–$7
(text example in the attached file)

Steps to Reproduce:
1.Open attached file
2.Apply regular expression to the three portions of the text concerned under the title Before replacement, there are two words in italics: garçons and morceau.
3.After replacement, some italics have been shifted as shown in the same file under the headings: After replacement and Highlighting of the italics changed

Actual Results:
Italics of original shifted

Expected Results:
They should remain where they are


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Version: 24.2.4.2 (AARCH64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 8; OS: macOS 14.5; UI render: Skia/Metal; VCL: osx
Locale: en-US (en.UTF-8); UI: en-US
Calc: threaded
Comment 1 Daniele 2024-07-06 17:05:08 UTC
Created attachment 195146 [details]
Test file with results shown

I have the impression that I have already submitted this bug, but I could not find any trace of it in my older bugs or my email.