Bug 138931 - Find&Replace: Can't escape a backslash in the replacement pattern (\\n treated like \n)
Summary: Find&Replace: Can't escape a backslash in the replacement pattern (\\n treate...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Find&Replace-Regex
  Show dependency treegraph
 
Reported: 2020-12-15 09:54 UTC by Kamil Landa
Modified: 2025-03-28 21:40 UTC (History)
3 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 Kamil Landa 2020-12-15 09:54:36 UTC
1) in Writer write Hello, press Ctrl+H for Find&Replace dialog
2) check Regular expressions, Find: e, Replace: \\n
3) do Replace All

It will replace the letter "e" by Enter (like for \n in the Replace), but correct replacement for \\n is string \n. 

For tabulator \t it replaces correctly. \t will do correctly tabulator, and \\t will do correctly string \t. 

Version: 7.1.0.0.beta1 (x64)
Build ID: 828a45a14a0b954e0e539f5a9a10ca31c81d8f53
CPU threads: 8; OS: Windows 10.0 Build 17763; UI render: Skia/Raster; VCL: win
Locale: cs-CZ (cs_CZ); UI: cs-CZ
Calc: CL
Comment 1 Dieter 2020-12-30 09:24:29 UTC
I confirm it with

Version: 7.2.0.0.alpha0+ (x64)
Build ID: 315c7570c4a72f4c834086082825533b1e50d1bf
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: threaded

actual result:
H
llo

exepcted result:
H\nllo
Comment 2 BogdanB 2021-01-29 20:29:48 UTC
Also in Version 3.6.7.2 (Build ID: e183d5b)
I think is inherited from OOo.
Comment 3 kdub 2023-11-22 15:09:04 UTC
Hey Kamil,

Thank you for reporting this bug. 

I can confirm that this bug is found in the following version:

Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 12; OS: Mac OS X 13.5; UI render: Skia/Metal; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 4 kdub 2023-11-22 15:12:27 UTC

*** This bug has been marked as a duplicate of bug 128999 ***
Comment 5 Buovjaga 2023-11-22 17:44:35 UTC
(In reply to kdub from comment #4)
> 
> *** This bug has been marked as a duplicate of bug 128999 ***

bug 128999 is about \n string being present in the document while this report is about escaping \n in the replace field.
Comment 6 Eyal Rozenberg 2025-03-28 21:40:25 UTC
The problem reported isn't with the dialog, just with the backend.

Problem persists in:

Version: 25.2.0.3 (X86_64) / LibreOffice Community
Build ID: e1cf4a87eb02d755bce1a01209907ea5ddc8f069
CPU threads: 4; OS: Linux 6.6; UI render: default; VCL: gtk3
Locale: en-IL (en_IL); UI: en-US