How to Use the Number Extractor
- Paste the source text — a log line, an invoice, scraped HTML or a sentence — into the input panel.
- Tick or untick Include negatives, Include decimals and Unique only to shape the regex and the result set.
- Pick the output separator (newline, comma or space) and click Extract Numbers.
- Copy the list to the clipboard, or use Download .txt to save it. The stats bar updates with count, sum, min, max and average.
The Number Extractor builds a regular expression on the fly from the four toggles and runs a single match() pass over your text. Captured tokens are returned in document order, optionally deduplicated through a Set, and joined with the separator you chose. Because the match is greedy on digits and the optional decimal part, it correctly grabs prices, percentages, IDs, line numbers and version components — but it deliberately does not interpret thousands separators (1,000 becomes 1 and 000) or scientific notation, since those rules vary by locale.
How the Number Extractor Works
Once a list is produced, every token is passed through Number() to build the stats panel. The sum is a simple reduce, min and max use Math.min/Math.max on the parsed array, and the average is sum divided by count, then rounded to four decimal places via toFixed(4) and toLocaleString() for thousands grouping. Empty input safely produces an empty result with the stats bar hidden, and very large pastes (hundreds of thousands of matches) stay responsive because nothing leaves the page.
- Regex is rebuilt per click from the negatives and decimals toggles
- Unique only dedupes via Set in first-seen order
- Stats bar: count, sum, min, max, arithmetic mean
- Output separator: newline, comma+space or single space
- Download as .txt for piping into another tool or spreadsheet
Frequently Asked Questions
Which numeric formats does the regex match?
The pattern matches an optional minus sign, one or more digits, and an optional fractional part — so 42, -7 and 3.14 are all captured. Scientific notation (1e6), hexadecimal (0xFF) and thousands-separated values like 1,000 are not treated as a single number.
How does the Unique-only option work?
With Unique only ticked, the matched strings are passed through a JavaScript Set so each distinct token appears once, in the order it was first seen. -3 and 3 are kept separate because the comparison is on the string, not the numeric value.
How are the count, sum, min, max and average calculated?
Each matched string is parsed with Number() and the stats panel shows the count, total, smallest, largest and arithmetic mean. The sum, min, max and average are rounded to four decimal places for display; the underlying floating-point math is JavaScript-standard double precision.
Will it pull numbers out of words like file2.txt or v1.5?
Yes — the regex isn't anchored to word boundaries, so 2 in file2.txt and 1.5 in v1.5 are extracted. Untick Include decimals if you want version strings split into 1 and 5, or untick Include negatives if a leading minus is part of a date or hyphenated identifier.
Explore the full suite of TEXT tools and 290+ other free utilities at Chunky Munster.