Bug 133084 - Search & Replace : Replace doesn't work with positive lookaround regex
Summary: Search & Replace : Replace doesn't work with positive lookaround regex
Status: RESOLVED DUPLICATE of bug 75806
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Find&Replace-Regex
  Show dependency treegraph
 
Reported: 2020-05-16 11:10 UTC by blank15927
Modified: 2021-12-06 14:22 UTC (History)
2 users (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 blank15927 2020-05-16 11:10:04 UTC
Description:
LibreOffice ignores the replacement string when there is a regex positive lookahead/lookbehind in the search field.

Steps to Reproduce:
1. Open a new ODT file in Writer
2. Type, for example, the following string : abbc
3. Open dialog Search & Replace
4. Regular expression Checked
5. Search for : (?<=a)b
6. Replace with : X (or whatever)


Actual Results:
LibreOffice find the first "b", but do not replace it. Replace is broken.

Expected Results:
Replace the first "b" with "X" : String should be now : aXbc


Reproducible: Always


User Profile Reset: No



Additional Info:

Step 5/6 can be reproduced with a positive lookahead :
Search for : b(?=c)
Replace with : X
Same thing : the string (last "b") is not replaced

-----------------------------

Interesting : negative lookahead/lookbehind work as expected.
Example : (?<!a)b or b(?!c)

-----------------------------

Version: 6.3.4.2 (x64)
Build ID: 60da17e045e08f1793c57c00ba83cdfce946d0aa
Threads CPU : 8; OS : Windows 10.0; UI Render : GL; VCL: win; 
Locale : fr-FR (fr_FR); Langue IHM : fr-FR
Calc: threaded
Comment 1 m_a_riosv 2020-05-16 13:22:16 UTC
(?<=a)b -> X, works for me

Versión: 6.3.5.2 (x64)
Id. de compilación: dd0751754f11728f69b42ee2af66670068624673
Subprocs. CPU: 4; SO: Windows 10.0; Repres. IU: GL; VCL: win; 
Configuración regional: es-ES (es_ES); Idioma de IU: es-ES Calc: CL

Version: 7.0.0.0.alpha1+ (x64)
Build ID: 30356cdb3581bc9e9118ef3dd2f3162d9256c3b6
CPU threads: 4; OS: Windows 10.0 Build 19608; UI render: Skia/Raster; VCL: win; 
Locale: es-ES (es_ES); UI: en-US Calc: CL
Comment 2 Dieter 2020-05-19 08:42:34 UTC
(In reply to m.a.riosv from comment #1)
> (?<=a)b -> X, works for me

I've got the same result

Version: 7.0.0.0.alpha1+ (x64)
Build ID: 99c337d1d3831ce9d2c7dc1cbff713f4ac49d6ac
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win; 
Locale: en-GB (de_DE); UI: en-GB
Calc: CL
Comment 3 Andreas Heinisch 2020-05-19 13:46:18 UTC
Should be fixed in https://bugs.documentfoundation.org/show_bug.cgi?id=75806
Comment 4 Dieter 2020-05-19 13:52:06 UTC
Blank15927, could you please try to reproduce it with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ ? I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the latest version. Change to RESOLVED WORKSFORME, if the problem went away.
Comment 5 blank15927 2020-05-20 06:52:45 UTC
*** Bug still present : 
Version : 6.4.3.2 (x64)
Build ID : 747b5d0ebf89f41c860ec2a39efd7cb15b54f2d8
Threads CPU : 8; OS : Windows 10.0 Build 18363; UI Render : GL; VCL: win; 
Locale : fr-FR (fr_FR); Langue IHM : fr-FR
Calc: CL


*** Bug still present : 
Version : 6.4.4.2 (x64)
Build ID : 3d775be2011f3886db32dfd395a6a6d1ca2630ff
Threads CPU : 8; OS : Windows 10.0 Build 18363; UI Render : GL; VCL: win; 
Locale : fr-FR (fr_FR); Langue IHM : fr-FR
Calc: CL


*** Bug has disappeared : S & R works as expected :
Version: 7.0.0.0.alpha1 (x86)
Build ID: 6a03b2a54143a9bc0c6d4c7f1...
Threads CPU : 8; OS : Windows 10.0 Build 18363; UI Render : Skia/Raster; VCL: win; 
Locale: fr-FR (fr_FR); UI: fr-FR
Calc: threaded

-----------------------------

For the record : 
- I also tried version 6.2.x, bug was already there.
- Replacements work as expected when clicking "Replace All".
- So it only affects positive lookahead/lookbehind when executing S & R step by step.
Comment 6 Dieter 2020-05-20 06:57:52 UTC
Thanks for testing. I just saw, that there is no backport to LO 6.4 in bug 75806. I don't know why, but this explains, why it is only solved in LO 7.0.0.0alpha1. 

=> RESOLVED DUPLICATE

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