Home  >  Q&A  >  body text

How to replace part of matching string in vim

I use vim to process documents and want to replace a certain part of a word. What should I do?
Give an example, such as

This is a word.

I want to replace the word in word. with sentence while retaining .. How to do this?

Supplement

Maybe I didn’t make it clear. What I mean is, replace the word in word., but do not replace the word alone or worder.

巴扎黑巴扎黑2712 days ago564

reply all(3)I'll reply

  • 漂亮男人

    漂亮男人2017-05-16 16:44:42

    :s/word\./sentence\./g

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-16 16:44:42

    :%s/word/sentence/gc

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-16 16:44:42

    :s/word./sentence./g

    reply
    0
  • Cancelreply