I want to convert a file which was indented using 2 spaces into one which uses tabs. How do i specify this regular expression replacing?
I can find the regular expression with this: /^( )+/
But how do i now replace each 2-space groups with a tab?
Thanks in advance.
SublimeText3 uses PCRE regex engine, thus you may use the following regex replacement:
Find: (^|\G)
(or a bit more visible (^|\G)[ ]{2}
)
Replace: \t
The (^|\G)
matches the start of a line (^
) or document or the end of the previous successful match (\G
), and the
(= [ ]{2}
) will match 2 regular spaces.