I'm searching for a tab at every end of a word. Something like \l\t now I want to replace the tab with a space.

How can I exchange the tab with a space without changing the word?

1 Answer 1


Search for (?<=\w)\t and replace by a space (or \s )

FYI: This will strictly look for a tab placed after any word character.

  • 1
    Thanks! How is (?<=\w) exactly working? How would it look like if I'm searching for a tab ahead of a word character?
    – Malte
    Commented Aug 31, 2017 at 13:06
  • (?<=xxx)yyy Is a positive lookbehind pattern. yyy is what you want to catch (\t stands for tab) and xxx is what must be placed before it (\w stands for word character) . Only yyy will be replaced, not what is between the brackets. \t(?=\w) would be the positive lookahead: it will catch tabs placed before any word character.
    – Vinny
    Commented Aug 31, 2017 at 13:29
  • Yeah, I got that. But how could I find e.g. tabs ahead of a word? I've tried \t(?<=\w) – That isn't the right syntax, isn't it?
    – Malte
    Commented Aug 31, 2017 at 13:34
  • 1
    \t(?=\w) is what you need. But you don't neccesraly need to remember all those GREP patterns, you can use the search/replace window > GREP and click on the @ then Match. Finally choose between the suggested patterns. Just add the query after the =
    – Vinny
    Commented Aug 31, 2017 at 13:37
  • 1
    @Malte The < is the bit that means ‘look backwards’, so if you're looking for things after a word, you don't want to include that. (?=) means look ahead; (?<=) means look back. Commented Aug 31, 2017 at 20:07

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.