项目作者: p-rs

项目描述 :
Escape regex characters easily with this simple binary - for copy/pasting into code projects, Splunk, and more. Pronounced as "escargot"!
高级语言: Go
项目地址: git://github.com/p-rs/eschargo.git
创建时间: 2020-11-02T23:12:16Z
项目社区:https://github.com/p-rs/eschargo

开源协议:MIT License

下载



EsCharGo


Escape Regex Metacharacters, made in Go



preview

Installation

  1. # brew
  2. brew tap p-rs/homebrew-eschargo
  3. brew install eschargo
  4. # scoop
  5. scoop bucket add eschargo https://github.com/p-rs/scoop-eschargo.git
  6. scoop install eschargo
  7. # via go build
  8. go build -o ecg github.com/p-rs/eschargo
  9. # or via releases
  10. tar xzf release-file.tgz /usr/local/bin/ecg

Usage

Run any standard in/out through ecg:

  1. # output: \[02/Nov/2020:21:50:22 \+0000\]
  2. ecg '[02/Nov/2020:21:50:22 +0000]'
  3. # outputs \[02/Nov/2020:21:50:22 \+0000\] to MacOS clipboard
  4. ecg '[02/Nov/2020:21:50:22 +0000]' | pbcopy
  5. # output: escapes characters in example.txt
  6. cat example.txt | ecg
  7. # outputs escapes characters in example.txt and outputs to MacOS clipboard
  8. cat example.txt | tr -d '\n' | ecg | pbcopy

Limitation

ecg does not account for bash/history escaping, so make sure to use single quotes.

License

MIT. See LICENSE for more details.