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.10.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

repren-0.3.10-py2-none-any.whl (13.8 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: repren-0.3.10.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.14.0 CPython/3.6.5

File hashes

Hashes for repren-0.3.10.tar.gz
Algorithm Hash digest
SHA256 e0f55540fe47eb3bf4eb170d86a9f24720e2500c601f41869b7d80ea55b1b4c5
MD5 a90d9580f33fdbd9e87fa8711c6a6abe
BLAKE2b-256 63a481b8e8cca95db6b274cc001a472b6791757e15b398e1dc2670a338714232

See more details on using hashes here.

File details

Details for the file repren-0.3.10-py2-none-any.whl.

File metadata

  • Download URL: repren-0.3.10-py2-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.14.0 CPython/3.6.5

File hashes

Hashes for repren-0.3.10-py2-none-any.whl
Algorithm Hash digest
SHA256 07217906e5ee8bfc639a6663578c764d0703c53c1a82e10166272eaefc50cbb3
MD5 2e296ba3ef06bcf341d579f1350a0108
BLAKE2b-256 78c2a466bbc33d3122fe2fb490fabc21ad2070907b2dc0cd72dc75aca5c542fd

See more details on using hashes here.

Supported by

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