^\\s*(\\d+):\\s*(.*)^\\s*(\\d+)\\.\\s*(.*)^\\s*\\[(\\d+)\\]\\s*(.*)^\\s*(\\d+)\\)\\s*(.*)^\\s*(\\d{3,})\\s+(.*){{ outputText }}
ℹ️ About Remove Line Numbers
Remove Line Numbers strips leading line numbers from copied code, terminal output, documentation, transcripts, and numbered text blocks. It is built for searches like "remove line numbers from code", "strip numbered lines", "unnumber text", and "clean pasted code listing" where the useful content should stay intact but the numeric margin should disappear.
The tool compares common line-number prefixes, then rewrites only the matching prefix at the start of each line. That makes it useful for cleaning examples copied from PDFs, blog posts, stack traces, manuals, or source-code viewers before pasting into an editor, diff tool, formatter, or shell.
Detection modes:
- Auto detection: Tests the first lines for repeated prefixes and reports a confidence score.
- Custom pattern: Uses a JavaScript regular expression when the numbering format is project-specific.
- Manual mode: Removes a generic leading number plus common separators such as
:,.,),], or whitespace.
Supported formats:
- Colon numbers:
1: text,002: text - Dot numbers:
1. text,42. text - Parentheses:
1) text,23) text - Bracketed numbers:
[1] text,[128] text - Whitespace columns:
0007 textor12 text - Custom capture patterns for logs, OCR output, transcripts, and mixed pasted snippets.
Example cleanup: 001: sudo systemctl status nginx becomes sudo systemctl status nginx, and [14] return true; becomes return true;. In custom pattern mode, capture the wanted text in the second group when possible, such as ^\s*(\d+):\s*(.*); if there is only one capture group, the tool uses that group as the cleaned line.
References: custom matching follows the JavaScript ECMAScript RegExp model. Line-numbered text often comes from tools such as the POSIX nl utility or GNU Coreutils nl, which add numeric prefixes for display or documentation.
Limitations and edge cases:
- Auto detection samples the beginning of the text, so heavily mixed formats may need a custom pattern.
- Numbers that are meaningful content at the start of a line can be removed if they look like line numbers.
- Wrapped PDF lines, OCR artifacts, and citations such as
[12]may require review after cleanup. - The browser UI processes text locally; use the API only for content you are comfortable sending to the server.
API Usage Example:
POST /api/tools/text/remove-line-numbers
Content-Type: application/json
{
"text": "1: First line\n2: Second line",
"detectionMode": "auto",
"customPattern": "",
"removeAll": true
}