Word find & replace with page numbers on the next line?

Jennifer E 0 Reputation points
2026-01-19T18:09:43.46+00:00

I've copied text from one document into a new Word file. Now I want to remove all instances of the headers and page numbers from the old document, so I'm just left with the text.

I'm looking for:

"Specific header text

1"

I can find and replace the "Specific header text", but I can't figure out the correct wildcards to use to find and remove all the page numbers that appear in the next line.

When I tried "Specific header text ^11 [0-9]{1,2}", it doesn't find any matches. Same with ^p.

Thanks!

Microsoft 365 and Office | Word | For business | Windows
{count} votes

2 answers

Sort by: Most helpful
  1. Jay Freedman 206.8K Reputation points Volunteer Moderator
    2026-01-19T21:58:46.02+00:00

    Following from your question and your comment on John Korchok's answer, I think that a Find expression similar to the one you used should work once you know exactly what character precedes the page number. Because the document has been converted from Word to PDF and back to Word, it may be something unexpected.

    Select the character in your Word document (easier to see it if you turn on nonprinting characters). Open the macro editor (Alt+F11) and press Ctrl+G to open the Immediate window. In the Immediate window, type

    Print Asc(Selection.Text)

    and press Enter. The ASCII code of the selected character will appear on the next line. Use that number in the Find expression. Also, be sure the expression uses exactly the same spaces as appear in the lines in the document -- for example, if there is no space between the last visible letter and the end-of-line character, don't put a space there in the Find expression.

    It may be useful to refer to https://www.gmayor.com/replace_using_wildcards.htm, especially the table headed "Control Codes that may be used with the search/replace tool". (The table isn't specific to wildcards.)

    3 people found this answer helpful.
    0 comments No comments

  2. John Korchok 228.8K Reputation points Volunteer Moderator
    2026-01-19T19:21:09.6433333+00:00

    Header and footer content automatically repeats on each page, so a find and replace is usually not needed. Instead, deleting the page number on one page will delete all the page numbers for the whole document, or all the page numbers for the section, if the headers and footers have been unlinked from each other.

    3 people found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.