Actually, the new line \n with Replace (Search & Replace) it passed as literal.
When entered in the Replace text box in Writer, inserts a paragraph break that can be inserted with the Enter or Return key.
It has no special meaning in Calc, and is treated literally there.
Modify it in Calc to work the same as in Writer, creating a new line.
(In reply to Mike Kaganski from tdf#43107 comment #26)
> (In reply to DN from tdf#43107 comment #20)
> > The content of "replace" should be interpreted as a regex (i.e.
> > \n should be interpreted as a newline, not a literal string).
> I want to stress that
> it's incorrect to consider *replacement* string as a "regex" - no, it is
> never so.
It is probably worth reading the entire original comment (and probably also those prior to it).
IDK whether that statement from Mike means that this RFE is not adequate.
In Mike comments, he said the behavior should be the same as Writer, only calling it regex it's not fine.
Mike seems to agree that it should be made consistent with Writer:
(In reply to Mike Kaganski from bug 43107 comment #26)
> I would argue that for consistency, exactly because in Calc, the
> newline in a cell inserts *paragraphs* (not only available in the file
> format, but also in the API; and that is not a bug), the \n in the
> replacement box should behave *consistently* with Writer, where it inserts
I think it makes sense too. -> New
(or did I misunderstand your point, Mike?)
Let's say this "started" in 7.5 as a follow-up to the documentation fix for bug 43107.
Confirmed that replacing <some_chars> with \n in Calc does not work as one would expect with "Regular Expressions" on.
Version: 18.104.22.168.alpha0+ (X86_64) / LibreOffice Community
Build ID: e9a0c97de95688b2f86bbb4dd8c823af5442401c
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
But in my (rather uninformed?) opinion, the whole thing should be made consistent across components with the wider-ranging change of:
- making $ work in both search and replace for paragraph breaks
- making \n work in both search and replace for line breaks
... and the distinction between the two would only matter in Writer (where both <text:line-break/> and <text:p> exist)
Would solve many headaches in my opinion.
Side note: questions (and SUBSTITUTE() workarounds) in https://ask.libreoffice.org/t/how-do-i-insert-line-breaks-in-calc-with-find-replace/5300 and https://ask.libreoffice.org/t/find-and-replace-with-a-carriage-return-in-librecalc/76389 and https://ask.libreoffice.org/t/regex-for-replace-with-new-line/52665 and https://ask.libreoffice.org/t/is-it-possible-to-use-a-regular-expression-in-the-replace-box-in-libreoffice-calc/41709