Regular expression – how to replace the intraline tag with spaces, keep alignment?

I like to use spaces to indent rather than labels; in sed or vim, it is easy to replace tabs at the beginning of the line:

s/^I/ /g

But if there are tabs in a line (assuming the space is the width of the tab characters):

'foo'^I ^I =>'bar',
'bazzle'^I =>'qux',

Each tab does not correspond to the set number of maintaining alignment Spaces. Anyone have a cunning idea, how to replace these tabs with spaces while maintaining proper alignment?

In Vim:

 :retab

Or, if you have a tag after the space:

:retab!

I like to use spaces to indent rather than labels; in sed or vim, it is easy to replace tabs at the beginning of the line:

s/^I/ /g

But if there are tabs in a line (assuming the space is the width of the tab characters):

'foo'^I ^I => 'bar',
'bazzle'^I =>'qux',

Each tab does not correspond to a set number of spaces to maintain alignment. Anyone has a cunning Idea, how to replace these tabs with spaces while maintaining correct alignment?

In Vim:

:retab

Or, if You have a tag after the space:

:retab!

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5444 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.