I OCRed a document but has this problem: some spaces between "of" and the word after are gone and I need to add a space between "of" and "word". Is there any way to do it? And also to avoid adding space after of in the words such as offer, off, often, office etc which start with "of".

  • Something like :%s/of\zs./ &? To make it work for your document we will probably need more details on the edge cases of your file. – statox Aug 7 '18 at 11:48
  • could you clarify what \zs./ & means? – Zheng Aug 7 '18 at 12:08
  • \zs is the beginning of what we will match. So we want to match any single character (.) following of. In the replacement part of the expression & is what was matched (the single character after of). If your file contains both ofword and of word you probably want to replace . with \w to match only word class characters. – statox Aug 7 '18 at 12:11
  • Thanks, it works. how to exclude words like often, offer, etc. in the replacement? (now I add gc at the end to confirm each replacement). – Zheng Aug 7 '18 at 12:27
  • Please edit your question with all your requirements, the comments are not meant to do that. – statox Aug 7 '18 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.