Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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


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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .