What the tool does
- MIME-aware targeting: processes only files whose MIME name contains
text/
orjson
(e.g., HTML, CSS, JS, CSV, MD, XML, YAML, INI, JSON). - Precise find & replace: simple text or regex patterns, optional case sensitivity and whole-word matching.
- Dry-run preview: see exactly which files and lines will change before writing.
- Selective scope: include/exclude paths, glob patterns, and file extensions.
- Encoding support: utf-8 by default with graceful handling of BOM.
- Safe writes: optional backups and atomic write strategy to minimize corruption risk.
- Change report: per-file diff summary with counts of matches and replacements.
Common use cases
- Rebranding & copy updates: product names, company details, legal text.
- URL/domain migrations: replace legacy hosts, CDN paths, asset prefixes.
- Config & secrets rotation: switch API endpoints or keys in non-binary configs.
- Codebase refactors: rename modules, CSS classes, and feature flags.
- Localization prep: extract or normalize hard-coded strings.
- Data hygiene: fix JSON property names, CSV headers, or schema typos.
How it works
- Choose a root folder for the scan.
- Set your pattern (plain text or regex) and the replacement value.
- Refine scope with include/exclude globs and extension filters.
- Run a dry-run to preview matched files and line snippets.
- Apply changes with backups enabled for easy rollback.
- Review the report for counts, files changed, and skipped items.
Why use MIME filtering?
Binary files often contain byte sequences that look like text. MIME filtering limits operations to textual formats, reducing false matches and preventing file corruption in images, fonts, archives, and executables.
Best practices
- Back up or use version control before large replacements.
- Prefer regex boundaries (e.g.,
\b
) to avoid partial word hits. - Target narrowly with include globs like
**/*.js
orcontent/**/*.md
. - Test on a small subset then scale to the full tree.
- Review diffs to confirm no unintended edits.
Limitations
- Skips true binary formats by design; if a file reports a non-text MIME, it will not be modified.
- Regex patterns that are overly broad can match more than intended—use preview and anchors.
- Very large monolithic files may require more memory; split or scope as needed.
FAQ
- Which files are included?
- Any file whose MIME type contains
text/
(e.g.,text/html
,text/css
,text/markdown
) orjson
(e.g.,application/json
). - Can I undo changes?
- Yes. Enable backups to create
.bak
copies, or rely on your VCS to revert specific hunks. - Does it change file permissions or timestamps?
- Permissions are preserved. Timestamps update on modified files only.
- Will it rewrite line endings?
- It preserves existing line endings (LF/CRLF) unless your environment enforces a different policy.
- How do I avoid changing variables inside code blocks I don’t want touched?
- Constrain scope with include globs, and use regex with anchors/contexts to match only safe regions.