Replace \n\n with \n\t in Google Docs
Asked Answered
C

3

7

I would like to replace two carriage returns (\n\n) with a carriage return and a tab (\n\t) in Google Docs (regular document NOT a spreadsheet). If I enter \n\t in replace with the simple text, as typed, is inserted, not the nonprinting characters. Is this a Google Doc limitation or is there a way to get around it?

Coheir answered 28/11, 2016 at 23:22 Comment(4)
can you add an example of your input text ?Altercation
\n\n in replace and \n\t in replace with. The pattern is found, yet the replacement is \n\t as text instead of the breakline and lead space at the beginning of the next line as expectedCoheir
Do you mean you are inside an open Google Document, and are using the Search and Replace dialog (Ctrl+H)?Heinie
Yes! That's it...Coheir
U
2

You can't do this from inside the Google Docs UI; it doesn't provide a way to specify the actual newline and tab characters for replacement.

Utilitarianism answered 3/9, 2020 at 22:32 Comment(1)
That's so inconvenient. Anyone who lands here please follow the advice in support.google.com/docs/thread/8197972?hl=en&msgid=8201646 to use "Help > Help Doc Improve" to send them feedback that we need to get the replace function to accept the special character as a replacement, e.g. \n\t as newline and tab characters for replacement when the RE match is turned on.Christianachristiane
W
0

Looked for this all morning and finally found a response here: https://support.google.com/docs/thread/246167941/how-can-i-remove-double-paragraph-breaks-from-a-large-document?hl=en

Go Mr. Shane! Here's the text in case the article disappears:

*I recommend you make a copy of the file before attempting the following suggestion.

  1. Open the Find and replace tool.
  2. Place a check-mark next to "Use regular expressions (e.g. \n for newline, \t for tab)"
  3. Enter this into the "Find" box: \n(?=\n)
  4. Leave "Replace with" empty (that means do NOT put anything into the box). Click "Replace all"*
Wishbone answered 30/9 at 10:28 Comment(1)
Thank you for the effort, but that does not address the OP's problem. The issue doesn't lie on searching for \n\n, but rather in replacing it with \n\t.Abroach
J
-1

You can by

  • Ctrl+H then \n+ (46hex code) for search

OR

  • search \n\s - replace with whatever you want
Justino answered 4/5, 2023 at 12:15 Comment(1)
The question specified searching for for \n\n not \n\s. The question was asking how to replace with \n\t and this is not currently supported. As the question states, Google Docs replaces with the actual characters "\n\t" and not a newline and a tab. Your answer does not address the question and your suggested solution does not work.Aceae

© 2022 - 2024 — McMap. All rights reserved.