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:
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.
Then change the style of the line:
Pattern (###^13) Repl. STYLE_SOMETHING ^p
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!