Project

match_with

0.0
No commit activity in last 3 years
No release in over 3 years
We can write regex in simple english
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.6
>= 0
 Project Readme

MatchWith

This gem internally used https://github.com/andrewberls/regularity

In regularity API is like

Regularity.new .start_with(3, :digits) .then('-') .then(2, :letters) .maybe('#') .one_of(['a','b']) .between([2,4], 'a') .end_with('$')

it will generate /^[0-9]{3}-[A-Za-z]{2}#?[a|b]a{2,4}\$$/

But if you want to match this Regex to string means you have to call

if "string"[Regularity.new.one_of(['a','b']).regex]

Here,

if "string".match_with.one_of(['a','b']).result

It is more clear.

Thanks to @andrewberls

Installation

Add this line to your application's Gemfile:

gem 'match_with'

And then execute:

$ bundle

Or install it yourself as:

$ gem install match_with

Usage

TODO: Write usage instructions here

Contributing

  1. Fork it ( https://github.com/[my-github-username]/match_with/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