I'm using Word 2016 and I need to delete some paragraphs, beginning or ending with known words. For example, in the following text:
¶
Lorem ipsum dolor sit amet, consectetur adipiscing elit.¶
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua,¶
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea.¶
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut enim ad minim veniam, ...¶
Paragraphs starting with a given word/string work as expected (delete 1st and 4th paragraphs):
Find What: "Lorem ipsum dolor *^13"
|
Replace With: ""
| Wildcard: On
Paragraphs ending with a given word/string are not working (delete 2nd paragraph). Tried:
"^13* magna aliqua,^13"
^10 = CR - deletes everything on the left, including previous paragraphs"^10*magna aliqua,^13"
^10 = LF - no changes
I've also tried some interesting examples on this site http://word.mvps.org/.../usingwildcards.htm but didn't find the solution.
Is there any way of doing this without VBA?
That's understandable, because the
*
matches any characters, including the CR, so the matched part extends from the first found CR over any paragraphs lain inbetween up to the one ending withmagna aliqua,
.In order to not match other paragraph endings, we have to use something other than
*
:The
[!^13]
means "any character except CR", the@
means "one or more occurrences of this".