Code Monkey home page Code Monkey logo

ruby_regex's People

Contributors

baweaver avatar carlesjove avatar eparreno avatar fguillen avatar guillermo avatar jaimeiniesta avatar juliend2 avatar klappy avatar moomerman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ruby_regex's Issues

New Release

I just pulled the GEM from RubyGems and some of my tests failed. I tested also against the Email regex from the source code and that worked. It took me 1 hour until I found this commit: c78eef0. This is not included in the GEM on RubyGems. Would be nice if you would release a new version a publish a new GEM on RubyGems.
Many Thanks.

Expanding Usage of RubyRegex from just Validation

Validation is one great usage of regex in ruby but I use searching more often than validation and there must be others that could take advantage of expanding the scope of this project.

Would you be interested in expanding the scope of this project to search for the defined regex in a larger context as well as the current usage of validation of a string only containing the desired pattern?

Since the current regex for each locates each on a line by itself it seems as if having an option to locate them in a line would be helpful. Nesting regex is quite simple in ruby and could be used to keep it dry.

email = /([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w-]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)/i
email_validation = /^#{email}&/

"this is my email: [email protected]"[email]
=> "[email protected]"

"[email protected]"[email_validation]
=> "[email protected]"

"this is my email: [email protected]"[email_validation]
=> nil

I can propose more some samples and examples of usage if necessary. Obviously some thought has to be invested in organization and backwards compatibility.

Thanks for your consideration!

Validation for given values

Sometimes you want to validate that an attribute matches one (and only one) option out of a given list.

# You allow those options
options = %w(one two)

# You generate this Regex with a GREAT amount of human effort
/\Aone\z|\Atwo\z/.match('three')

This could be generated with a method:

RubyRegex::one_of_these(options)

# or maybe
RubyRegex::Generator::one_of_these(options)

=> /\Aone\z|\Atwo\z/

Would you consider adding regex generators, as such? If so, I could send a PR with this particular case.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.