Convert a Ruby range to a regexp.
Ruby
Latest commit 3cc0f61 May 24, 2015 @ka8725 Merge pull request #1 from aliaksandrb/reversed_ranges_support
Reversed ranges support
Permalink
Failed to load latest commit information.
lib Small readability improvement May 23, 2015
test Tests for reversed ranges May 23, 2015
.gitignore Gem boilerplate Mar 22, 2015
Gemfile Gem boilerplate Mar 22, 2015
LICENSE.txt Gem boilerplate Mar 22, 2015
README.md Gem boilerplate Mar 22, 2015
Rakefile Gem boilerplate Mar 22, 2015
range_regexp.gemspec Gemspec Mar 22, 2015

README.md

Transform Ruby ranges to regexps

The solution to convert a Ruby Range to a Regexp

Install

In the system:

gem install range-regexp

or add the gem to the Gemfile:

gem 'range-regexp'

and then run bundle install.

Usage

converter = RangeRegexp::Converter.new(-9..9)
converter.convert # => /-[1-9]|\d/