Detect numeric vs text items in a list

Count how many list items are numbers vs non-numbers. The regex `/^-?\d+(\.\d+)?$/` is applied to each trimmed line: if it matches, the line counts as numeric; if not, it counts as text. Output is a three-line report: `Numeric: N / Text: M / Total: N+M`.

Input
Ready
Output
Live

Regex-based number-or-not classifier

The exact rule per line: `/^-?\d+(\.\d+)?$/` is tested against `line.trim()`. A line matches only if it is an optional leading `-`, one or more digits, and an optional decimal fraction. Matches count as numeric; non-matches count as text. Blank or whitespace-only lines are skipped before the test so they do not pad either bucket.

The regex is strict: no thousands separators, no scientific notation, no leading `+`, no hex or binary literals. `1,000` counts as text (comma is not a digit); `1e5` counts as text (no exponent support); `+5` counts as text (only `-` is allowed as a sign prefix).

Output is a three-line report: `Numeric: N`, `Text: M`, `Total: N+M`. The status bar shows the same counts in condensed form.

How to use detect numeric vs text items in a list

  1. 1Paste your list into the input panel
  2. 2Each trimmed non-blank line is tested against `/^-?\d+(\.\d+)?$/`
  3. 3Output shows `Numeric: N` / `Text: M` / `Total: N+M`
  4. 4No options - the regex is fixed
  5. 5For the values themselves (not the counts), use Filter numbers

Keyboard shortcuts

Drive ListShift without touching the mouse.

Shortcut Action
Ctrl ZUndo last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor
EscExit fullscreen
Ctrl KOpen the command palette to jump to any tool
Ctrl SSave current pipeline draft Plus
Ctrl PRun a saved pipeline Plus

What this tool actually does

One regex, applied per line, counts matches vs non-matches.

Strict integer / decimal match

`/^-?\d+(\.\d+)?$/` - optional `-`, mandatory digits, optional `.digits`. Any deviation counts as text.

No thousands separators or scientific notation

`1,000`, `1_000`, `1e5`, `0x1A` all count as text. Pre-process with Replace if you need to normalise the numeric shape before detection.

Blank lines are skipped

Empty or whitespace-only lines are filtered before the regex runs. They do not add to Numeric, Text, or Total.

Whitespace tolerated at line edges

The line is trimmed before the regex test, so ` 123 ` matches as numeric. Internal whitespace in a "number" still fails (e.g. `1 000` is text).

For the items, not just the counts

Filter numbers applies the same shape test but returns the matching (or non-matching) lines instead of a count. Pick by whether you want the tally or the data.

Worked example

Three integer lines (`123`, `456`, `789`) and three non-numeric lines. Total = 6.

Input
123
apple
456
banana
789
carrot
Output
Numeric: 3
Text: 3
Total: 6

Behavior reference

No user options. These are the fixed rules.

Rule What it does Example
Numeric pattern `/^-?\d+(\.\d+)?$/` after trim `123`, `-42`, `3.14` → numeric; `1,000`, `1e5`, `+5` → text
Blank lines skipped Filtered before the regex test Trailing blank does not add to Total
Edge whitespace tolerated Trim runs before the regex test ` 123 ` → numeric
Internal whitespace fails Breaks the regex `1 000` → text

FAQ

Why does `1,000` count as text?
The regex only matches digits after an optional `-` and before an optional `.digits`. Commas are not digits. Neither are underscores, thousands separators, or spaces. Pre-process with Replace to strip commas if you want `1,000` to count as numeric.
Does it recognise scientific notation like `1e5`?
No. The regex has no `e` / `E` branch. `1e5` counts as text. `1.5e10` also counts as text.
Can I see which items were numeric instead of just the count?
Yes - use Filter numbers. Same pattern, but it returns the matching (or non-matching) lines rather than a tally.
How does this handle blank lines?
Skipped before counting. `Numeric + Text = Total` is always the count of non-blank lines, never the raw input line count.
What about hex or binary numbers (`0x1A`, `0b101`)?
They count as text - the regex only accepts decimal form. Convert them to decimal first with Replace (or an external tool) if you want them tallied as numeric.