A python package that traverse files based on some regex pattern to select certain files and then update the text in these files using regex.
Project description
Text Replace
Description
A python package that traverse files based on some regex pattern to select certain files and then update the text in these files using regex.
Install
PyPI: pip install text-replace
Source: git clone https://github.com/Salaah01/text-replace.git
Usage
usage: python -m text_replace [-h] [-d ROOT_DIR] [-f FILE_PATTERN] [-s] [-r] [-t TEXT_PATTERN] [-m {default,relative-url-prefixer}] [-n NEW_TEXT]
Search through files and replace text.
optional arguments:
-h, --help show this help message and exit
-d ROOT_DIR, --root-dir ROOT_DIR
Root directory.
-f FILE_PATTERN, --file-pattern FILE_PATTERN
Regex pattern to follow when searching for files.
-s, --skip-check Show a list of files that will potentially be changed before proceeding.
-r, --recursive Recursively search for files?
-t TEXT_PATTERN, --text-pattern TEXT_PATTERN
Regex pattern for searching for text to replace.
-m {default,relative-url-prefixer}, --mode {default,relative-url-prefixer}
-n NEW_TEXT, --new-text NEW_TEXT
Next text to replace the old text with.
Presets
Preset exist within test_replace/presets
and they include helpful shortcuts
to perform certain replaces. These include:
-
Updates the relative URLs in your files to include a prefix. e.g: /about becomes iamsalaah.com/about where the prefix set is iamsalaah.com.relative_url_prefixer
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
text-replace-0.1.1.tar.gz
(5.2 kB
view details)
Built Distribution
File details
Details for the file text-replace-0.1.1.tar.gz
.
File metadata
- Download URL: text-replace-0.1.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44cce7a07d5a24fd227eb5c868460ba64e8d1be130bf68b8bbc4306f13e3e2f5 |
|
MD5 | 984ae292f672c11018c959a8a136f2ec |
|
BLAKE2b-256 | aaca33c7043b0deb4419c5ccedccfa8d70d5fc62fdfb2505853d1186fe497612 |
File details
Details for the file text_replace-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: text_replace-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02ae517ba4598a0575dacc3a809bfbc1eed2c6b4b89af806789fa61efed2dc6d |
|
MD5 | 33b7a19e19703815785a1a9ae7b384cc |
|
BLAKE2b-256 | 52f8a6db4714eda8aa5c4020bafc32fe8651dc648f035cadfc7d02ded3d5fb45 |