I have a Word 2010 document containing a list of blocks with predifined styles. The styles are used in another software to process these blocks.

I created the document using a wrong quickpart so all the blocks contain a wrong style in their identifier line.

Here the ID line of the blocks:

PREFIX_111_222_SUFFIX_incrementalID: The title of the block

The ID is incremental (001, 002, 003, ...), and the title is different for each block. For example:

  • PREFIX_111_222_SUFFIX_001: This is the title of #1
  • PREFIX_111_222_SUFFIX_002: Here is title #2

And the styles are:

  • PREFIX_111_222_SUFFIX_incrementalID: has "Style1"
  • The title of the block has "Style2"
  • ¶ has style "Normal"

The problem is that ¶ should have been Sytle1 in the Quickpart! Now I need to change all of them so that they use the correct style.

Is there a way to achieve that with Word 2010?

I quite trained using "standard" regexp (python, perl, vim, etc.), but I am totally stuck with Word.

I really need help on this one.

Edit: Here is what I tryed so far:

First I tried to match the ID. I tried those patterns but they all fail:

  • (PREFIX_111_222_SUFFIX_*>) *:
  • (PREFIX_111_222_SUFFIX_*>) *:(*)(^13)

It selects 2 lines instead of just one...

My idea is to:

  1. First add # to identify the areas I want to work with:

    Pattern (PREFIX_111_222_SUFFIX_*>) *:(\*)^13
    Replacement string: \1: \2###

Of course I tried many other patterns but none of them matches the whole and only the whole line.

  1. Then change the style of the line:

    Pattern (###^13)

But can't get step 1 to work. So I am totally stuck.

Here is some text sample I tried with:

PREFIX_111_222_SUFFIX_0001: The title of the block
Subcat1: XYZ
Subcat2: XYZ

PREFIX_111_222_SUFFIX_0002: The title of the block
Subcat1: XYZ
Subcat2: XYZ

Sorry, for the delay I am quite overbooked those days... Thank you again for your help!

  • 1
    please share what have you tried and why those doesn't work. It'd be much more easy to help then reproducing your whole issue. – Máté Juhász Jan 18 '16 at 14:31
  • Solution, however probably will need to use a stepwise approach: 1. change the style of your whole quickpart to style1 2. change the style of text (without paragraph mark) to style 2 3. change style of prefix to style 1 – Máté Juhász Jan 18 '16 at 14:35
  • @MátéJuhász: I added some details regarding my unsuccessful attempts. Sorry for the delay, I am really busy those days. Thanks for your help and suggestions! – Plouff Jan 20 '16 at 9:25

I finally found why I was totally lost. I didn't checked the boxes "ignore punctuation" and "ignore spaces". I only checked "use special characters"

Now a pattern like:


Is successfully accepted.

So like I said before, I used # to identify my titles so that I can apply the correct style to them with another search and replace!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.