Microsoft Word affords the ability to search on formatting type and replace it. This feature is great in my line of work, where I have to convert Word documents into online surveys. A simple example would be to find a
boldword and replace it with
<strong>bold</strong>. However, there are cases where the document we receive has extraneous white-space in between said formatting. This makes the process of finding and replacing all bold text a bit more tricky. Also, there are cases where a single or multiple white spaces have formatting when they should not.
1.) What is the regex to find and replace all white-space that does not need formatting. The criteria for "does not need" is it cannot be the last white-space on the line, or it cannot be in between two words that require formatting. Essentially, I'm trying to create the cleanest Replace All possible.
In the screenshot, you will see the italicized text may have white-space that is not italicized.
Also, in the screenshot, the very last row is bolded throughout, all white-space after the word "Total" should not be bolded.
The macro I'm looking for (or it could just be a regex) will need to be intuitive to some degree.