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

  1. Fork it ( https://github.com/[my-github-username]/regexp_scan/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request