1

I have the following issue. I recently wrote a macro that allows me to replace all TAB insertions in a text with a space. This is a must as in the frame I am working in, as it happens a lot (context: document clean-ups after conversions).

Now the one frame where this is bad (thus that a TAB is converted to a space) is when the TAB is on the beginning of a new line. In that specific case it would be better if the TAB was converted to nothing, so the first thing on the beginning of the line would be the a symbol (e.g. the paragraph begins with " xxx", while it should begin with "xxx").

I tried to fix this with the word search function by using wildcards, but to no avail. I thought that I could search for something like "[!?] ?" (thus this would imply, by my reasoning, that Word should search for all instances where there is no symbol at first then there is a space and then there is any symbol). Searching for "^p " also doesn't seem to do the trick.

Would you have any suggestions as to how to solve the issue?

Thank you for any feedback!

1 Answer 1

0

Searching with wildcards for ([^l|^13])( ) will find a line break - both manual and paragraph breaks - with a following blank (and put them into separate groups). Use \1 in the replace field to omit the blank, but retain the line break.

3
  • Thank you a lot for this, works like a charm! Could you perhaps explain how this works ([^l|^13])( ) and also if perhaps there exists a wild card library (the windows one is quite limited)? This is the first time I saw the expression ^13 for example.
    – Noir
    Oct 18, 2016 at 8:18
  • Okay, let's start with (). Those are used to create searching groups. Those groups can be later referenced in the replacement field. ([0-9])([a-z]) will find a number followed by a letter, puts the number in group 1 and the letter in group 2. If you now use the replacement \2 \1 you insert the found letter (group 2) followed by the found number (group 1). ^l finds manual line breaks, ^13 those before a paragraph. Unfortunately I don't know if there is some kind of library, I just found them on a German wiki site
    – Aki
    Oct 18, 2016 at 8:30
  • Thank you for the elaboration. I will take a look at the wiki (I speak German so it is not a problem). Thanks once again!
    – Noir
    Oct 18, 2016 at 8:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .