Skip to content

1 or 2 credits, some free · 1 credit is about $1

pocketshelf

Regex Pack: Text Cleanup

A 1-page snippet pack for cleaning and normalising text: 10 short entries with copy-ready code.

ForDevelopers

regex-pack-text-cleanup.pdfShowing 10 of 39 lines
// Collapse whitespace
const pattern = /\s{2,}/g;
pattern.test("a  b"); // true

// Trim both ends
const pattern = /^\s+|\s+$/g;
pattern.test("  hi"); // true

// Blank lines
const pattern = /^\s*$/m;

What's inside

Format
PDF, Markdown, JS
Contents
10 patterns
Version
1.0 · Updated 3 Oct 2026
Licence
Commercial What this means
Checked
Checked before it ships
  • regex-pack-text-cleanup.pdfPDF · 18 KB
  • regex-pack-text-cleanup.mdMarkdown · 1 KB
  • regex-pack-text-cleanup.jsJS · 788 B
  • LICENSE.txtadded to every download

About this item

A compact, printable snippet pack for cleaning and normalising text. Each of the 10 entries has a one-line explanation and a small example you can paste into your editor. The PDF uses a two-column A4 layout designed to sit next to your keyboard, and the same content ships as Markdown so you can search it or drop it into your notes, plus a JavaScript module that exports every pattern. Every JavaScript example targets ES2023.

Reviews

No reviews yet.

You might also grab