PDA

View Full Version : [SOLVED:] Removing text of a particular style and surrounding spaces



SFRandy
03-14-2021, 04:57 PM
I often create word documents that have two different styles of text. Normal style is the actual contents and "MyNotes" style is notes entered inline with the actual content. The notes are added in parenthesis, like the below examples. I would like to delete all content that is in parenthesis and (not or) of the MyNotes style. I would also like to correct the spacing around the removed text (regardless of whether the spaces around the parenthetical are of Normal or MyNotes style), as in the below examples. The corrected spacing would also (ideally) be changed to the normal style, but this isn't a deal breaker.

Example 1 (italics used to represent the "MyNotes" style):
Before: The first vehicle (such as a car (2-door or 4-door) or truck) can reach speeds of 150mph.
After: The first vehicle can reach speeds of 150mph.

Example 2 (note that "bright" uses the "MyNotes" style, but should not be removed because it is not in parentheticals):
Before: The toaster has a bright color (that cannot be changed).
After: The toaster has a bright color.

Example 3:
Before: I appreciate your help. (I've spent a few hours but can't figure it out.)
After: I appreciate your help.

I would highly appreciate any guidance or particular resources I should review.

macropod
03-14-2021, 07:24 PM
You could use a wildcard Find/Replace, where:
Find = [^s ]\([!\(]@\)
Replace = nothing
and you specify the Find Style.

To process you first example, the F/R will need to be executed twice.

SFRandy
03-15-2021, 10:58 AM
Thanks! I will try this to see if I can make it work.

Chas Kenyon
03-15-2021, 12:13 PM
If you are not giving out the original but printing or sending to pdf, you could simply change the formatting of your style to Hidden.

SFRandy
03-15-2021, 04:03 PM
Thanks, unfortunately, hidden won't work. I'm also aware of the styles option (ctrl-alt-shift-S, then right click on style) to highlight all text of a particular style, then hit "DEL" key to delete it all. This deletes all text of that format, including text not in parenthesis. The select/delete strategy also messes up the formatting (e.g., changes indents and line spacing) for some reason.

macropod
03-15-2021, 04:37 PM
you could simply change the formatting of your style to Hidden.
But that would also hide content in that Style not bounded by parentheses, which is not what the OP wants.