Gathering detailed insights and metrics for rexreplace
Gathering detailed insights and metrics for rexreplace
Gathering detailed insights and metrics for rexreplace
Gathering detailed insights and metrics for rexreplace
Smooth find & replace CLI as it should be: simple file selection with globs, flexible patterns with regex and dynamic replacements from js code.
npm install rexreplace
Typescript
Module System
Node Version
NPM Version
HTML (91.69%)
Shell (4.69%)
TypeScript (2.85%)
JavaScript (0.77%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
26 Stars
658 Commits
4 Forks
2 Watchers
18 Branches
6 Contributors
Updated on Jul 02, 2025
Latest Version
7.1.13
Package Id
rexreplace@7.1.13
Unpacked Size
171.47 kB
Size
26.04 kB
File Count
8
NPM Version
10.8.2
Node Version
20.19.1
Published on
May 10, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
RexReplace is a versatile tool to search and replace text in files from the command line. It's inspired by how developers often need to do quick fixes or one-liners for build scripts.
Key features:
docs/*.md
represents each markdown file in docs/
)find
, cat
, sed
, tr
, and awk
to replace a text pattern in the right filesTo use RexReplace from your command line
1> npm install -g rexreplace
To use RexReplace from an npm build script:
1> yarn add rexreplace --dev 2# or 3> npm install rexreplace --save-dev
Let 'foobar' become 'xxxbar' in myfile.md
1> rexreplace 'Foo' 'xxx' myfile.md
Hard for your fingers to write on your keyboard? We got you covered with the rr
alias for rexreplace
1> rr Foo xxx myfile.md
Let all markdown files in the docs/
dir get headlines moved one level deeper
1> rexreplace '^#' '##' docs/*.md
Fix a spell error in all javascript and typescript files in the folders src/
and test/
recursively.
1> rexreplace 'foubar' 'foobar' '{src,test}/**/*.{js,ts}'
Let the version number from package.json get into your distribution js files (use the string VERSION
in your source files).
1> rexreplace 'VERSION' 'require("./package.json").version' -j dist/*.js
Require have been given the alias r
and both are expanded to understand relative paths even without ./
prepended. As the file extension is not needed eighter you will get the same result writing:
1> rexreplace 'VERSION' 'r("package").version' -j dist/*.js
Let 'foobar' become 'barfoo' in myfile.md
1> rexreplace '(foo)(.*)' '$2$1' myfile.md
RexReplace defaults to treating €
as an alias for $
so the following will do the same as the previous example
1> rexreplace '(foo)(.*)' '€2€1' myfile.md
Let foo[bar]
become foo.0.[bar]
in myfile.md
1> rexreplace '\[' '.0.[' myfile.md
The [
as a literate char must be escaped according to regex. If you run the command as a parameter (this could be from a script in package.json) you need to escape the escape:
1"scripts":{ 2 "fix": "rexreplace '\\[' '.0.[' myfile.md" 3}
RexReplace defaults to treating §
as an alias for \
so the following give same result:
1> rexreplace '§[' '.0.[' myfile.md
1"scripts":{ 2 "fix": "rexreplace '§[' '.0.[' myfile.md" 3}
Per file info
Add creation time, name of the file and human readable file size as the first line in each file in test-run
recursively.
1> rexreplace '^' 'ctime_ + name_ + size + nl' -j -M 'dist/**/*.*'
Matching pairs
Let both "foo 'is' bar"
and ' foo "was" bar'
' become » foo ... bar «
independent of using '
or "
1> rexreplace '(['"])([^\1]+)\1' '» $2 «' myfile.md
1> rexreplace pattern replacement [fileGlob|option]+
Flag | Effect |
---|---|
-v | --version Print rexreplace version (can be given as only argument) [boolean] |
-V | --verbose More chatty output [boolean] |
-L | --literal Literal string search (no regex used when searching) [boolean] |
-I | --void-ignore-case Void case insensitive search pattern. [boolean] |
-G | --void-global Void global search (stop looking after the first match). [boolean] |
-s | --dot-all Have . also match newline. [boolean] |
-M | --void-multiline Void multiline search pattern. Makes ^ and $ match start/end of whole content rather than each line. [boolean] |
-u | --unicode Treat pattern as a sequence of unicode code points. [boolean] |
-e | --encoding Encoding of files/piped data. [default: "utf8"] |
-E | --engine What regex engine to use: [choices: "V8"] [default: "V8"] |
-q | --quiet Only display errors (no other info) [boolean] |
-Q | --quiet-total Never display errors or info [boolean] |
-H | --halt Halt on first error [boolean] [default: false] |
-d | --debug Print debug info [boolean] |
-€ | --void-euro Void having € as alias for $ in pattern and replacement parameters [boolean] |
-§ | --void-section Void having § as alias for \ in pattern and replacement parameters [boolean] |
-o | --output Output the final result instead of saving to file. Will also output content even if no replacement has taken place. [boolean] |
-A | --void-async Handle files in a synchronous flow. Good to limit memory usage when handling large files. [boolean] |
-B | --void-backup Avoid temporary backing up file. Works async (independent of -A flag) and will speed up things but at one point data lives only in memory, and you will lose the content if the process is abrupted. [boolean] |
-b | --keep-backup Keep a backup file of the original content. [boolean] |
-m | --output-match Output each match on a new line. Will not replace any content but you still need to provide a dummy value (like _ ) as replacement parameter. If search pattern does not contain matching groups the full match will be outputted. If search pattern does contain matching groups only matching groups will be outputted (same line with no delimiter). [boolean] |
-T | --trim-pipe Trim piped data before processing. If piped data only consists of chars that can be trimmed (new line, space, tabs...) it will become an empty string. [boolean] |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
27 out of 27 merged PRs checked by a CI test -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
update tool detected
Details
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
0 existing vulnerabilities detected
Reason
project has 2 contributing companies or organizations -- score normalized to 6
Details
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Score
Last Scanned on 2024-08-14T18:14:27Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More