RegexpScan
This is ruby gem.
This gem provide String#scan
for CLI.
Strings filter by Regexp.
Pickup strings that match the regular expression from source string.
Installation
Add this line to your application's Gemfile:
gem 'regexp_scan'
And then execute:
$ bundle
Or install it yourself as:
$ gem install regexp_scan
Usage
Use for ARGV
$ reg-scan "\d+" "[111,222,333]"
111
222
333
Use for STDIN
$ cat input.text
[111,222]
[333,444]
[555]
$ cat input.text | ./bin/reg-scan "\d+"
111
222
333
444
555
option: -o
only first
$ reg-scan -o "\d+" "[111,222,333]"
111
s
Contributing
- Fork it ( https://github.com/[my-github-username]/regexp_scan/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request