Sắp Xếp Văn Bản — Sắp dòng hoặc CSV theo preset hoặc regex

Sắp dòng hoặc dòng CSV theo preset hoặc key regex. Dán văn bản hoặc nhập CSV. Miễn phí, không đăng ký—chạy trên trình duyệt.

Sắp dòng hoặc CSV theo preset hoặc regex. Miễn phí, không đăng ký, trên trình duyệt.

Sắp xếp từng dòng hoặc dòng CSV bằng preset (A–Z, độ dài, số, ngẫu nhiên) hoặc trích key bằng regex. Dán văn bản hoặc nhập file CSV. Mọi xử lý trên trình duyệt—không tải lên.

Đang tải công cụ…

Dùng cho

  • Danh sách — sắp dòng A–Z hoặc theo độ dài
  • CSV — sắp dòng rồi xuất lại
  • Key tùy chỉnh — dùng regex trích key sắp xếp
  • Thứ tự ngẫu nhiên — xáo danh sách

1. What does this tool do

This free online text sorter lets you sort lines or CSV rows by a preset (A–Z, Z–A, shortest first, longest first, numeric, or random) or by a regex-extracted key. You can paste text (one item per line) or import a CSV file; each line or row is one chunk. After sorting, you can copy the result or export it as CSV. No sign-up, no upload; all processing runs in your browser.

2. How to use it

Quick start: Choose Paste text or Import CSV, add your input, pick Preset or Regex sort mode, then click Sort. Copy or export the result.

  1. InputPaste text: type or paste with one item per line. Optionally trim lines and omit empty lines (both default on). Import CSV: click Import CSV and select a file; each row becomes one chunk.
  2. Sort modePreset: choose A–Z, Z–A, Shortest first, Longest first, Numeric, or Random. Regex: enter a pattern (e.g. (\d+) to sort by the first number in each chunk), set flags (g, i, m), and optionally tick “Sort key numerically”.
  3. Click Sort — The tool sorts the chunks and shows the result.
  4. Copy or Export — Copy the sorted list (newline-separated) or click Export CSV to download (optionally with an index column).

3. How it works

  • Chunks from text — The input is split by newlines. Each line is trimmed (if “Trim lines” is on) and empty lines are dropped (if “Omit empty lines” is on). The resulting list is the set of chunks.
  • Chunks from CSV — The CSV is parsed (headers and rows). Each row is turned into one string (cells joined by comma). That list is the set of chunks. Headers are not treated specially; the first row can be included or excluded depending on your CSV.
  • Preset sortA–Z / Z–A: localeCompare. Length: by string length ascending or descending. Numeric: parseFloat on the whole chunk; non-numeric chunks sort last. Random: Fisher–Yates shuffle.
  • Regex sort — For each chunk, the pattern is run once. If there is a first capture group, its value is the sort key; otherwise the full match; if there is no match, the whole chunk is the key. Chunks are then sorted by that key (as string or number if “Sort key numerically” is on). Invalid regex or over-length input returns an error.

Export CSV — Same format as the Text Splitter: one row per chunk, optional index column, RFC 4180 escaping.

All computation runs in your browser. No data is sent to any server.

4. Use cases & examples

  • Word or line lists — Paste a list, sort A–Z or by length.
  • CSV rows — Import a CSV, sort rows by the whole row string (e.g. A–Z), then export again.
  • Sort by number in line — Use regex mode with a pattern like (\d+) and “Sort key numerically” to order lines by the first number in each line.
  • Random order — Use Random preset to shuffle a list.

Example (Preset A–Z):
Input lines: zebra, apple, mango
Result: apple, mango, zebra

Example (Regex item-(\d+), numeric):
Input: item-30, item-10, item-20
Keys: 30, 10, 20 → Result: item-10, item-20, item-30

5. Limitations & known constraints

  • Input cap — Total text length (all chunks combined) limited to 100,000 characters in regex mode; preset mode has no extra limit beyond normal UI responsiveness.
  • Regex — Pattern limited to 500 characters; same validation as Regex Cleaner. Invalid pattern or over-length input shows an error.
  • Client-side only — No server; processing runs in the browser.
  • CSV — One chunk per row; “sort by column” (reorder rows by a chosen column) may be added in a future update.

Câu trả lời nhanh

Tất cả tính toán và chuyển đổi chạy hoàn toàn trên trình duyệt. Không có dữ liệu được gửi đến máy chủ, dữ liệu của bạn không rời khỏi thiết bị.