Skip to main content

AltF Flow recipe

Number a list, or fix its numbering

When items are added, removed or reordered, a numbered list ends up with gaps and repeats. This recipe trims lines, removes blanks, strips any existing number followed by a dot or bracket at the start of a line, and numbers every line again from 1 with a dot and a space, so the list reads 1, 2, 3 without manual edits.

  • Free, no sign-up
  • Runs in your browser
  • Nothing uploaded
  • Share recipes as a link

4 steps · runs in your browser · nothing uploaded

Pipeline

  1. Remove leading and trailing spaces from each line.

    7 → 7 lines
  2. Remove all

    7 → 6 lines (-1)
  3. Find: ^\\d+[.)]\\s*, Regular expression

    6 → 6 lines
  4. Start at: 1, After number: . , Skip empty lines

    6 → 6 lines

7lines30words147chars

6lines31words147chars-1 lines vs input

The 4 steps in this recipe

  1. 1

    Trim every line

    Remove leading and trailing spaces from each line.

  2. 2

    Remove empty lines - Remove all

    Delete blank lines, or squeeze runs of blank lines down to one so paragraphs stay apart.

  3. 3

    Find and replace - Find: ^\\d+[.)]\\s*, Regular expression

    Replace text everywhere. Supports regular expressions with $1 back-references.

  4. 4

    Number lines - Start at: 1, After number: . , Skip empty lines

    Put 1., 2., 3. (or any separator) in front of each line.

Change any option in the workspace above, switch a step off to compare, or add your own steps. Save it to reuse it, or share the recipe as a link.

Worked example

Before
1. Preheat the oven to 200C
2. Chop the vegetables

4) Toss with olive oil and salt
Spread on a baking tray
  7. Roast for 30 minutes
3. Serve warm
After
1. Preheat the oven to 200C
2. Chop the vegetables
3. Toss with olive oil and salt
4. Spread on a baking tray
5. Roast for 30 minutes
6. Serve warm

Why each step is there

  • Trim and remove empty lines so the numbering is continuous and indentation does not hide an old number.
  • The replace step removes only a leading number with . or ) after it; numbers later in the line, like 200C or 30 minutes, are untouched.
  • Number lines then adds 1., 2., 3. in the current order.

Variations

  • Change the separator to ") " or " - " for a different style, or to "\t" to paste into a spreadsheet as two columns.
  • Set Start at to continue a list from another page.
  • Add Sort lines before numbering to rank items alphabetically, or Shuffle lines with a seed for a random running order.

Number or renumber a list: questions and answers

Can I keep blank lines between items?

Yes. Delete the Remove empty lines step; Number lines skips empty lines by default so they stay unnumbered.

Does it handle lists numbered like 1.1 or A.?

No. Only plain numbers are stripped. Adjust the regular expression for other schemes.

Can I number in reverse for a countdown?

Add Reverse line order before numbering and again after it.

More recipes like this

Every step you can add (41)

Clean up

  • Trim whitespace
  • Trim every line
  • Remove empty lines
  • Collapse repeated spaces
  • Remove line breaks
  • Strip HTML tags
  • Straighten smart quotes
  • Remove accents
  • Remove punctuation
  • Remove emoji
  • Remove non-ASCII characters

Change case

  • Change case
  • Make URL slugs

Lines

  • Sort lines
  • Remove duplicate lines
  • Keep only duplicated lines
  • Compare with another list
  • Count repeated lines
  • Reverse line order
  • Shuffle lines
  • Keep a range of lines
  • Truncate long lines
  • Wrap at a width
  • Split into lines
  • Join lines

Find and filter

  • Find and replace
  • Filter lines
  • Remove words or characters

Extract

  • Extract

Data and formats

  • Format JSON
  • Minify JSON
  • CSV to JSON
  • JSON to CSV
  • Lines to JSON array
  • JSON array to lines

Encode and decode

  • Encode or decode

Build output

  • Add prefix / suffix
  • Quote each line
  • Number lines
  • Apply a line template
  • Add timestamp
What each step does, with its options

AltF Flow runs entirely in your browser. Your text is never sent to AltFTool; saved recipes stay in this browser and shared links carry the steps only.