Skip to main content

Replace ONE occuranceoccurrence of something with MULTIPLE charactersinstances of something

How can ityou replace one charactermatch with multiple occurrenceinstances of a character (like \t)?

It's

It's no problem to replace multiple characters with one. But I did not find the answer for the opposite.

For example: I want to change

Items: item1 item2 item3 item4

to

Items:
                item1
                item2
                ...

and for the whitespace I want to use \t tabstop (for example). Something like:

:%s/\s\(item.\)/\r\t{5}\1/g

does not work.

Replace ONE occurance of something with MULTIPLE characters of something

How can it replace one character with multiple occurrence of a character (like \t)

It's no problem to replace multiple characters with one. But I did not find the answer for the opposite.

For example: I want to change

Items: item1 item2 item3 item4

to

Items:
                item1
                item2
                ...

and for the whitespace I want to use \t tabstop (for example). Something like:

%s/\s\(item.\)/\r\t{5}\1/g

does not work.

Replace ONE occurrence of something with MULTIPLE instances of something

How can you replace one match with multiple instances of a character (like \t)?

It's no problem to replace multiple characters with one. But I did not find the answer for the opposite.

For example: I want to change

Items: item1 item2 item3 item4

to

Items:
                item1
                item2
                ...

and for the whitespace I want to use \t tabstop (for example). Something like:

:%s/\s\(item.\)/\r\t{5}\1/g

does not work.

typo
Source Link
MacMartin
  • 271
  • 3
  • 8

How can it replace one character with multiple occurancesoccurrence of a character (like \t)

It's no problem to replace multiple characters with one. But I did not find the answer for the opposite.

For example: I want to change

Items: item1 item2 item3 item4

to

Items:
                item1
                item2
                ...

and for the whitespace I want to use \t tabstop (for example). Something like:

%s/\s\(item.\)/\r\t{5}\1/g

does not work.

How can it replace one character with multiple occurances of a character (like \t)

It's no problem to replace multiple characters with one. But I did not find the answer for the opposite.

For example: I want to change

Items: item1 item2 item3 item4

to

Items:
                item1
                item2
                ...

and for the whitespace I want to use \t tabstop (for example). Something like:

%s/\s\(item.\)/\r\t{5}\1/g

does not work.

How can it replace one character with multiple occurrence of a character (like \t)

It's no problem to replace multiple characters with one. But I did not find the answer for the opposite.

For example: I want to change

Items: item1 item2 item3 item4

to

Items:
                item1
                item2
                ...

and for the whitespace I want to use \t tabstop (for example). Something like:

%s/\s\(item.\)/\r\t{5}\1/g

does not work.

%s instead of s%
Source Link
mMontu
  • 6.7k
  • 22
  • 31

How can it replace one character with multiple occurances of a character (like \t)

It's no problem to replace multiple characters with one. But I did not find the answer for the opposite.

For example: I want to change

Items: item1 item2 item3 item4

to

Items:
                item1
                item2
                ...

and for the whitespace I want to use \t tabstop (for example). Something like:

s%%s/\s\(item.\)/\r\t{5}\1/g

does not work.

How can it replace one character with multiple occurances of a character (like \t)

It's no problem to replace multiple characters with one. But I did not find the answer for the opposite.

For example: I want to change

Items: item1 item2 item3 item4

to

Items:
                item1
                item2
                ...

and for the whitespace I want to use \t tabstop (for example). Something like:

s%/\s\(item.\)/\r\t{5}\1/g

does not work.

How can it replace one character with multiple occurances of a character (like \t)

It's no problem to replace multiple characters with one. But I did not find the answer for the opposite.

For example: I want to change

Items: item1 item2 item3 item4

to

Items:
                item1
                item2
                ...

and for the whitespace I want to use \t tabstop (for example). Something like:

%s/\s\(item.\)/\r\t{5}\1/g

does not work.

Source Link
MacMartin
  • 271
  • 3
  • 8
Loading