4

Edit 2023-06: I just did some testing and the issue is that replacement characters (the bottom input box) are taken literally, even when the regex option is check-marked. Regex for characters to be replaced (the top input box) works fine.

That is, what regexes do I place in these two boxes enter image description here

I have read Syntax for Unicode characters in regexes in Google Sheets? to no avail.

I found from one answer that [\n] matches paragraph mark. Now all I need is the character for Shift+Enter.

4
  • The recent edit should be rolled back as it's a different issue. It's worth mentioning that Regex never worked on the "Replace with" box. Also, it's worth mentioning that this question was answered three years ago, but just that answer just got an unvote in May. Jun 29, 2023 at 19:24
  • @Wicket It's the same issue. I asked how I can replace a character with another one. The answer, which I explained in the edit, is that it is not possible.
    – zylstra
    Jun 30, 2023 at 22:12
  • Edits should not invalidate already posted answers. Jun 30, 2023 at 22:48
  • Well, since the edit is simply an explanation (and answer) of the original question it could not have changed the validity of already-posted answers.
    – zylstra
    Jul 2, 2023 at 1:44

3 Answers 3

3

The "shift-enter" character in Google Docs is called "vertical tab".

Dec Hex Binary HTML Char Description
9 09 00001001 	 HT Horizontal Tab
10 0A 00001010 
 LF Line Feed
11 0B 00001011  VT Vertical Tab
12 0C 00001100  FF Form Feed

Thus, on regex search/replace, you can \v or \x0B to represent the shift-enter (Vertical Tab).

Note: Line Feed is the normal enter, represented there as a paragraph mark. Form Feed is the forced page break.

1
  • I just did some testing and the issue is that the replacement character is taken literally, even when the regex option is check-marked. Regex for the character to be replaced works fine.
    – zylstra
    Jun 29, 2023 at 18:59
1

Try [^\S\n\t ]

  • \S matches any non-white character
  • \n matches a paragraph mark
  • \t matches a tab
  •  matches a white space
  • [^] means not so [^\S\n\t ] matches any character that is not non-white character, is not a paragraph mark, is not a tab character and is not any a blank space.

Reference

-2

I think what you are looking for is CHAR(10)

As an example:

=Join(CHAR(10),"Line", "New line")

CHAR(10) new line

1
  • 1
    I'm looking for the regexes for replacement in Google Docs.
    – zylstra
    Jun 3, 2020 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.