67

In Sublime Text 2, I want search and replace by the TAB character.

I tried replacing with \t char but it's not working.

How can I do it?

2 Answers 2

103

You can use regular expressions by clicking on this button:

sublime

The regex for a Tab character is \t.

4
  • 11
    Thanks works fine. But you don't need use / before and after \t is enough
    – shingara
    Feb 29, 2012 at 15:37
  • Also, it's possible to insert/paste a symbol of an actual tab(ASCII, 9 or U+0009) into "Replace" field. Couldn't paste here because the StackOverflow replaces these in comments section.
    – Artfaith
    Oct 12, 2020 at 13:27
  • I am trying to search for a pipe | and replace with a tab, when i use regular expression search as shown above, the search seems to match every character - maybe i have to escape the pipe? e.g. search for \|? Feb 8, 2022 at 5:26
  • It works. Thx for you!
    – dlarchikov
    Jun 20, 2023 at 7:33
1

The accepted answer only give half of the answer to the question

If you want to replace ',' and insert tab: enter image description here

But to replace the tab text with real tab you first have to replace tab text with a different character, and then do the tab insert:

Step1/2) enter image description here

Step2/2) enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .