I have a document with paragraphs where some sentences end with a dot and one space (". Nextline")
, while others end with a dot and two spaces (". Nextline")
. I want to replace replace dot and one space to dot and two spaces but without increasing existing dot and two spaces to dot and three spaces.
The sentences of paragraph are not ending with newline or "\n", except the last one. There will be a newline character at the end of the paragraph. I want to start each sentence with 2 spaces, neither 1 nor 3 or more. If I use search and replace from the menu, sentences starting with 2 spaces increase to 3 spaces at their start.
How can I do that? I tried following but it increases two spaces to three:
(defun space12 ()
(interactive)
(while (re-search-forward "\\. ?" nil t)
(replace-match ". ")))
Where is the problem and how can I correct it.
Sample input text:
This is first sentence (I called it line earlier). This sentence has one space at start. This has two. And this again has one space at start.