Unwanted spaces when using "replace text in word document"

The task is to read text from PDF, extract only the relevant content, and lastly, replace some text within a word document with this new extracted relevant data. The workflow adopted by me -
“Read PDF Text” to get the pdf data in a string format - Everything works fine.
Use “matches” and configure regex to extract relevant content - successfully able to do it.
Use “Replace text in Document” to replace a string within word doc with the new extracted data - ISSUE LIES HERE!!!


As you can see in the attached snapshots, words “accompanying” and “mental” are at the very end of sentence within PDF. When adding content to word, that is exactly where there are unwanted spaces. Please help!!!


Try this

Wouldn’t that eliminate the spaces between title - “Brief description of Services” and the start of paragraph too ? I only want to eliminate the spaces which are weirdly inserted mid-sentence. I think this has something to do with the READ PDF TEXT activity which is reading each pdf sentence as a separate line and not as a continuous text. Hope this makes sense.