Thanks for coming to, the world's #1 resource for all things InDesign!

Remove the Numbers at the Beginning of a List with a Simple GREP

I often need to format material that someone has sent in a text file, or from text copied from a web page. One of the most annoying things is dealing with a long list of numbered paragraphs, because I need to strip off the manual numbers and replace them with automatic paragraph numbers.

For example, I just grabbed this text from Thad McIlroy’s wonderful Future of Publishing site, pasted it into an InDesign text frame and applied automatic numbering to it. The result (with Type > Show Hidden Characters turned on) is this:


To clean it up, I need to remove that second set of numbers — the “hard coded” ones that are actually typed in the text — and the extra spaces that follow. Fortunately, it’s very easy with a quick GREP find/change:

You can open Find/Change, select the GREP tab, and type this into the Find what field: ^\d+?\.\s+

Then, leave the Change to field blank (so that it actually deletes whatever it finds).


If you want to assign a paragraph style to each paragraph it finds, then use the Change Format field at the bottom of the dialog box. (You may need to click More Options to see that.) However, if you assign formatting here, then InDesign will not delete the text it finds! It’s kind of tricky… if there is formatting specified and the Change To field is blank, then it applies that styling and leaves the text. If both Change To and Change Format are blank then it deletes the text. So to assign a paragraph style: first run the find/change to apply the style, and then run it again with the Change Format blank, so that it removes the hard-coded numbers and spaces.

David Blatner

David Blatner

David Blatner is the co-founder of the Creative Publishing Network, InDesign Magazine, and the author or co-author of 15 books, including Real World InDesign. His InDesign videos at are among the most watched InDesign training in the world. You can find more about David at
David Blatner

Latest posts by David Blatner (see all)

  • - November 30, -0001
Related Articles

12 Comments on “Remove the Numbers at the Beginning of a List with a Simple GREP

  1. I do this quite a lot too – except a bit simpler on the GREP :)


    I only do this on Selected Text though. I wouldn’t run this through a whole document.

    I do it this way because sometimes some people tend to add a Space before the number, or sometimes even a tab, or sometimes they will put a space between the number and the full stop, like so “10 .”

  2. Actually (on testing) it won’t find something like (10 .) at all.

    Hmm, I’m sure there has to be a “catch all” GREP?

  3. Hi

    For testing, I copy a bunch of numbered paragraphs from MS Word and paste into InDeisgn, but David,s command (^\d+?\.\s+) doesn’t work for me!?! but Eugene Tyson (^.+?\s+) works well. I don,t know why the first command (David,s command) doesn,t answer to me and InDesign warns me: “can,t find match”.
    but very handy.
    Now could you help me to find a complete list of these kind of useful commands for GREP?

    Thanks a lot

  4. @Masoud: my grep works for me for numbered lists copied form Word. But note that my grep code searches for:
    a number, followed by a dot (period), followed by one or more spaces
    If your numbered list has no dots, for example, then you’d need to remove the backslash-dot part of the code.

    As for additional codes, I suggest doing a search on our site for grep, such as these pages:

  5. I’ve been wanting to get rid of the hard-coded numbering because I constantly revise the list. I build the site directly in WordPress these days, and the built-in number is very ugly. So I keep doing it the hard way.

    Best regards, Thad

  6. @Thad: LOL. No reason to apologize for it. It’s not WP or you, it’s the whole copy and paste thing from one app to another, especially a web browser to InDesign. That’s where even html’s OL formatting gets turned “hard-coded.”

  7. @Stewart: absolutely!

    Just to nit-pick: your first ‘?’ is not necessary here. It selects ‘the shortest possible sequence of digits, but of course that’s equal to the longest possible in this context.

  8. I’m trying to do the opposite: turn a numbered list into a “hard-coded” list. FYI, I need hard-coded numbers for a endnotes-to-links script to work (part of my epub conversion workflow). Any suggestions?

Leave a Reply

Your email address will not be published. Required fields are marked *