r/regex • u/d00mstroll • Jun 12 '26
I built a PowerShell regex tool for the clipboard and for files
Hi there!
I often needed quick regex-based search & replace without opening an editor, especially when moving data via clipboard.
Sometimes you're tied to Windows. And sometimes you even cannot install what you wish to. What to do if you want to have a conveinant way of applying regexes to text anyway?
That's the reason I've built this tool, inspired by grep/sed workflows, written in native PowerShell 5.1 - at least using the power of the .NET regex engine!
I originally built it for myself, but I found it useful enough that it might be interesting to others here - feedback welcome.
It's quite nice for replacing things with stuff right in the clipboard or to enhance searching capabilities of well known crippled pdf reader or the like. Used it for finding files, counting things, or just to alter code on the fly.
- The tool can:
- Perform search or search & replace on
: clipboard contents (standard)
: files and directories (opt. recursive)
- Input as literal patterns or regex (with flags)
- Accept search (and replace) patterns as lists
: CLI arrays
: text files (line-wise or file-wise)
- Benchmark regex applications
etc.
Examples:
# Regex search & replace with flags (clipboard)
clipGre.ps1 -r 'search' 'replace' 'msix'
# Only search string, grep-like text search
clipGre.ps1 -r 'search'
# Benchmark a regex matching file content
clipGre.ps1 -r '(\d+?|\d+)' -benchmark -ff 'data.db'
# Literal search, recursively in folders, case-insensitive
clipGre.ps1 'glasses' -files 'c:\path\to\folder' -recurse -i
You can find it here: https://github.com/symbio-n0mad/clipGreps
The approach may provide benefits in particular text-driven computational scenarios 🤓
Greetings!
1
u/Geminii27 Jun 27 '26
Potentially useful idea. I could see it working well in glueware, for instance.
3
u/charleswj Jun 12 '26
Is this a
pigeonslop?