Skip to main content

repren: Multi-pattern string replacement and file renaming

Project description

Repren is a simple but flexible command-line tool for rewriting file contents according to a set of regular expression patterns, and to rename or move files according to patterns. Essentially, it is a general-purpose, brute-force text file refactoring tool. For example, repren could rename all occurrences of certain class and variable names in a set of Java source files, while simultaneously renaming the Java files according to the same pattern. It’s more powerful than usual options like perl -pie, rpl, or sed:

  • It can also rename files, including moving files and creating directories.

  • It supports fully expressive regular expression substitutions.

  • It performs group renamings, i.e. rename “foo” as “bar”, and “bar” as “foo” at once, without requiring a temporary intermediate rename.

  • It is careful. It has a nondestructive mode, and prints clear stats on its changes. It leaves backups. File operations are done atomically, so interruptions never leave a previously existing file truncated or partly edited.

  • It supports “magic” case-preserving renames that let you find and rename identifiers with case variants (lowerCamel, UpperCamel, lower_underscore, and UPPER_UNDERSCORE) consistently.

  • It has this nice documentaion!

If file paths are provided, repren replaces those files in place, leaving a backup with extension “.orig”. If directory paths are provided, it applies replacements recursively to all files in the supplied paths that are not in the exclude pattern. If no arguments are supplied, it reads from stdin and writes to stdout.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repren-0.3.8.tar.gz (8.4 kB view details)

Uploaded Source

File details

Details for the file repren-0.3.8.tar.gz.

File metadata

  • Download URL: repren-0.3.8.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for repren-0.3.8.tar.gz
Algorithm Hash digest
SHA256 1a438e43bb28c9bf58243a48c1b00b0bc49fcad0abbc983b2549a0c1d91dea8c
MD5 851b3747fe22e8b8206783a529f601fb
BLAKE2b-256 06cb383d4da7b40f2b75586b88cf2b9f21ed81438ccbd75b698e685d5dd56ed8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page