Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm attempting to automatically format portions of a significantly sized document. For one, I'm attempting to apply Heading 1 to all headings in the format of:

1.1       Heading 1

and Heading 2 to:

1.1.1     Heading 2

etc.

For Heading 1, I used the following expression in the Find What box:

^13[0-9]{1,}.[0-9]{1,}[!.]*^13

The issue with the expression is that it also selects the preceding newline. The preceeding newline is required so mentions of the numbers within the text are not also selected. I'm ending up with all of the preceeding lines becoming Heading's too!

Is it possible to do a reg-ex style selecting text using the expression above preceeded by a newline, without selecting the newline itself?

share|improve this question
    
The compromise solution I've used (though far less then ideal) is to dump it into Jedit, and run a reg-ex proper from there, putting the headings between <H1> </H1> tags with the replace, and then search/replacing the styles with the tags in Word. An all in Word solution would still be appreciated –  lochok Aug 30 '12 at 23:59

1 Answer 1

I use an extra step where I first find numbers preceded by paragraphs and replace formatting only with highlighting. Make sure you have selected a colour for your highlighter before you run the find (ie highlight colour not set to No Color).

Then I do my find and replace to apply the Heading style and no highlighting to number sequence (ie ignore the ^13 in this find) which are highlighted (as I know all those are the heading numbers, all other numbers in the doc are not highlighted).

Then a final find and replace to find all ^13 which are highlighted and replace with format not highlighted.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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