Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Doc CleanupNew to Visual Studio Code? Get it now.
Doc Cleanup

Doc Cleanup

sakinis

| (0) | Free
Cleanup documents using configurable regex replace rules to remove noise before comparing files.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Doc Cleanup

Clean up noisy document content using configurable regex replace rules. Useful for normalizing timestamps, IDs, or other dynamic values before comparing files.

Features

Clean Documents

Run Doc Cleanup: Clean Active Document from the Command Palette to apply all configured regex rules to the current editor.

Visual Rule Configuration

Run Doc Cleanup: Configure Rules to open a UI for managing rules:

  • Add, edit, and delete rules in a table view
  • Real-time regex validation
  • No need to edit JSON manually

Import/Export Rules

  • Import: Load rules from a JSON file to quickly set up or share configurations
  • Export: Save current rules to a JSON file for backup or sharing with teammates

Commands

Command Description
Doc Cleanup: Clean Active Document Apply all rules to the current editor
Doc Cleanup: Configure Rules Open the rules configuration UI

Rule Configuration

Each rule has:

  • Description (optional): A name for the rule
  • Pattern: A regex pattern (without slashes)
  • Replacement: The replacement string
  • Flags (optional): Regex flags (g is added automatically)

Example Rules

Normalize timestamps:

{
  "description": "Normalize timestamps",
  "pattern": "\"timestamp\":\\s*\"[^\"]+\"",
  "replacement": "\"timestamp\": \"<TIMESTAMP>\""
}

Normalize UUIDs:

{
  "description": "Normalize UUIDs",
  "pattern": "\"id\":\\s*\"[0-9a-fA-F-]{36}\"",
  "replacement": "\"id\": \"<UUID>\"",
  "flags": "i"
}

Normalize both string and number IDs:

{
  "description": "Normalize IDs",
  "pattern": "\"id\":\\s*(\"[^\"]+\"|\\d+)",
  "replacement": "\"id\": \"<ID>\""
}

Import/Export Format

Rules can be imported/exported as a JSON array:

[
  { "description": "Rule 1", "pattern": "...", "replacement": "..." },
  { "description": "Rule 2", "pattern": "...", "replacement": "..." }
]

Or as an object with a rules property:

{
  "rules": [
    { "description": "Rule 1", "pattern": "...", "replacement": "..." }
  ]
}

Notes

  • Rules run in order; each rule applies to the output of the previous one
  • Invalid rules are skipped and reported in the Doc Cleanup output channel
  • The g (global) flag is added automatically to all patterns
  • Only replace operations are supported
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft