regexifi 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5b922ccdec0818c7d5bc95257afafc7fbe3678b6e33ba029c32968f589fd0636
4
+ data.tar.gz: 7a6e7c2297e848957a418523a23757183b032fe9d813b74a098c737b711c1317
5
+ SHA512:
6
+ metadata.gz: 74e5ba81b4d76ba7636fcbe574c716a3ec2ea995b783cfd50fde285dfe8686a6ecf75ea9dcacbc8072bc6ade20267fc6d83cd5a9d1bdc5bc11245a21ddfe6f39
7
+ data.tar.gz: bc72e0f76be6faf64523325fdf5e83c1865125c1cb325a63c0b8311b241153a7bbef273096d74d0c3ae3d6affa52a22bb36d2a81dbb6e62b29c2898b1b221afc
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,76 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6.1
3
+
4
+ Rails:
5
+ Enabled: true
6
+
7
+ # Commonly used screens these days easily fit more than 80 characters.
8
+ Metrics/LineLength:
9
+ Max: 120
10
+
11
+ Metrics/MethodLength:
12
+ Max: 20
13
+
14
+ Metrics/BlockLength:
15
+ Max: 60
16
+
17
+ # The guiding principle of classes is SRP, SRP can't be accurately measured by LoC
18
+ Metrics/ClassLength:
19
+ Max: 500
20
+
21
+ Style/FrozenStringLiteralComment:
22
+ Enabled: false
23
+
24
+ Style/StringLiterals:
25
+ EnforcedStyle: double_quotes
26
+
27
+ Style/SymbolArray:
28
+ Enabled: true
29
+
30
+ Style/HashSyntax:
31
+ EnforcedStyle: ruby19_no_mixed_keys
32
+
33
+ Style/FormatString:
34
+ EnforcedStyle: percent
35
+
36
+
37
+ Style/CollectionMethods:
38
+ Enabled: true
39
+ PreferredMethods:
40
+ reduce: "reduce"
41
+
42
+ Style/ParenthesesAroundCondition:
43
+ AllowSafeAssignment: false
44
+ Lint/AssignmentInCondition:
45
+ AllowSafeAssignment: false
46
+
47
+ Style/SignalException:
48
+ EnforcedStyle: only_raise
49
+
50
+ # has_key? and has_value? are far more readable than key? and value?
51
+ Style/PreferredHashMethods:
52
+ Enabled: false
53
+
54
+ Layout/AlignHash:
55
+ EnforcedHashRocketStyle: separator
56
+ EnforcedColonStyle: separator
57
+
58
+ Layout/ExtraSpacing:
59
+ AllowForAlignment: true
60
+ # When true, forces the alignment of `=` in assignments on consecutive lines.
61
+ ForceEqualSignAlignment: true
62
+
63
+ Layout/IndentationConsistency:
64
+ EnforcedStyle: rails
65
+
66
+ Layout/DotPosition:
67
+ EnforcedStyle: trailing
68
+
69
+ Documentation:
70
+ Enabled: false
71
+
72
+ Style/SpaceInsideBlockBraces:
73
+ SpaceBeforeBlockParameters: false
74
+
75
+ Style/SpaceInsideHashLiteralBraces:
76
+ EnforcedStyle: no_space
@@ -0,0 +1,11 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.3.8
7
+ - 2.4.2
8
+ - 2.5.2
9
+ - 2.6.1
10
+
11
+ before_install: gem install bundler -v 1.17.2
@@ -0,0 +1,64 @@
1
+ # Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers have the right to remove, edit, or
37
+ reject comments, commits, code, wiki edits, issues, and other contributions
38
+ that are not aligned to this Code of Conduct, or to ban temporarily or
39
+ permanently any contributor for other behaviors that they deem inappropriate,
40
+ threatening, offensive, or harmful.
41
+
42
+ ## Scope
43
+
44
+ This Code of Conduct applies both within project spaces and in public spaces
45
+ when an individual is representing the project or its community. Examples of
46
+ representing a project or community include using an official project e-mail
47
+ address, posting via an official social media account, or acting as an appointed
48
+ representative at an online or offline event. Representation of a project may be
49
+ further defined and clarified by project maintainers.
50
+
51
+ ## Enforcement
52
+
53
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
54
+ reported by contacting the project team via Github. All
55
+ complaints will be reviewed and investigated and will result in a response that
56
+ is deemed necessary and appropriate to the circumstances.
57
+
58
+ ## Attribution
59
+
60
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
61
+ available at [http://contributor-covenant.org/version/1/4][version]
62
+
63
+ [homepage]: http://contributor-covenant.org
64
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in regexifi.gemspec
6
+ gemspec
@@ -0,0 +1,102 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ regexifi (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.0)
10
+ coderay (1.1.2)
11
+ diff-lcs (1.3)
12
+ ffi (1.10.0)
13
+ formatador (0.2.5)
14
+ guard (2.15.0)
15
+ formatador (>= 0.2.4)
16
+ listen (>= 2.7, < 4.0)
17
+ lumberjack (>= 1.0.12, < 2.0)
18
+ nenv (~> 0.1)
19
+ notiffany (~> 0.0)
20
+ pry (>= 0.9.12)
21
+ shellany (~> 0.0)
22
+ thor (>= 0.18.1)
23
+ guard-bundler (2.2.1)
24
+ bundler (>= 1.3.0, < 3)
25
+ guard (~> 2.2)
26
+ guard-compat (~> 1.1)
27
+ guard-compat (1.2.1)
28
+ guard-rspec (4.7.3)
29
+ guard (~> 2.1)
30
+ guard-compat (~> 1.1)
31
+ rspec (>= 2.99.0, < 4.0)
32
+ guard-rubocop (1.3.0)
33
+ guard (~> 2.0)
34
+ rubocop (~> 0.20)
35
+ jaro_winkler (1.5.2)
36
+ listen (3.1.5)
37
+ rb-fsevent (~> 0.9, >= 0.9.4)
38
+ rb-inotify (~> 0.9, >= 0.9.7)
39
+ ruby_dep (~> 1.2)
40
+ lumberjack (1.0.13)
41
+ method_source (0.9.2)
42
+ nenv (0.3.0)
43
+ notiffany (0.1.1)
44
+ nenv (~> 0.1)
45
+ shellany (~> 0.0)
46
+ parallel (1.14.0)
47
+ parser (2.6.0.0)
48
+ ast (~> 2.4.0)
49
+ powerpack (0.1.2)
50
+ pry (0.12.2)
51
+ coderay (~> 1.1.0)
52
+ method_source (~> 0.9.0)
53
+ psych (3.1.0)
54
+ rainbow (3.0.0)
55
+ rake (12.3.2)
56
+ rb-fsevent (0.10.3)
57
+ rb-inotify (0.10.0)
58
+ ffi (~> 1.0)
59
+ rspec (3.8.0)
60
+ rspec-core (~> 3.8.0)
61
+ rspec-expectations (~> 3.8.0)
62
+ rspec-mocks (~> 3.8.0)
63
+ rspec-core (3.8.0)
64
+ rspec-support (~> 3.8.0)
65
+ rspec-expectations (3.8.2)
66
+ diff-lcs (>= 1.2.0, < 2.0)
67
+ rspec-support (~> 3.8.0)
68
+ rspec-mocks (3.8.0)
69
+ diff-lcs (>= 1.2.0, < 2.0)
70
+ rspec-support (~> 3.8.0)
71
+ rspec-support (3.8.0)
72
+ rubocop (0.65.0)
73
+ jaro_winkler (~> 1.5.1)
74
+ parallel (~> 1.10)
75
+ parser (>= 2.5, != 2.5.1.1)
76
+ powerpack (~> 0.1)
77
+ psych (>= 3.1.0)
78
+ rainbow (>= 2.2.2, < 4.0)
79
+ ruby-progressbar (~> 1.7)
80
+ unicode-display_width (~> 1.4.0)
81
+ ruby-progressbar (1.10.0)
82
+ ruby_dep (1.5.0)
83
+ shellany (0.0.1)
84
+ thor (0.20.3)
85
+ unicode-display_width (1.4.1)
86
+
87
+ PLATFORMS
88
+ ruby
89
+
90
+ DEPENDENCIES
91
+ bundler
92
+ guard (~> 2.1)
93
+ guard-bundler
94
+ guard-rspec (~> 4.7)
95
+ guard-rubocop
96
+ pry (~> 0.12)
97
+ rake (~> 12.3)
98
+ regexifi!
99
+ rspec (~> 3.0)
100
+
101
+ BUNDLED WITH
102
+ 1.17.2
@@ -0,0 +1,18 @@
1
+ scope group: :specs
2
+
3
+ group 'specs', halt_on_fail: true do
4
+ guard :bundler do
5
+ watch('Gemfile')
6
+ end
7
+
8
+ guard :rspec, all_on_start: true, cmd: 'rspec -c -fp ' do
9
+ watch(%r{^spec/.+_spec\.rb$})
10
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
11
+ watch('spec/spec_helper.rb') { "spec/lib" }
12
+ end
13
+
14
+ guard :rubocop, all_on_start: false, cmd: 'rubocop --format fuubar -F -D' do
15
+ watch(%r{^spec/.+_spec\.rb$})
16
+ watch(%r{^lib/(.+)\.rb$})
17
+ end
18
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Nick Gorbikoff
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,120 @@
1
+ # Regexifi
2
+ A collection of tested common REGEX expressions. Because why re-invent the wheel every time for a new project?
3
+
4
+ Don't add a bunch of ad-hoc REGEX expressions for common things like email addresses, urls, usernames, time formats - Regexifi instead!
5
+
6
+ It's not that difficult to add a couple of Regex constant at the top of your class, but it's much more difficult to come up with **good**, **tested** and **consistent** Regex expressions for most common validations.
7
+
8
+ P.S.:
9
+ Please, add more examples and tests, and, _**of course**_, more REGEXP! Open an issue if you want to discuss a certain expression or if you don't think it's warranted.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'regexifi'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install regexifi
26
+
27
+ ## Usage
28
+
29
+ You can require the whole gem with all REGEXP, or just specific ones
30
+
31
+ ```ruby
32
+ require 'regexifi'
33
+
34
+ # or
35
+
36
+ require 'regexifi/email'
37
+
38
+ # Then include it in your class or call directly
39
+
40
+
41
+ class UrlChecker
42
+ include Regexifi
43
+ end
44
+ UrlChecker::Url::DOMAIN
45
+
46
+ # Or use it directly in you code. - these are just regular Regular Expressions, pardon the pun.
47
+
48
+ "my.email@example.com".match? Regexifi::Email::RFC6068 #=> true
49
+ "my.email@example.com".match Regexifi::Email::RFC6068 #=> <MatchData "my.email@example.com">
50
+ "my.email@example.com" =~ Regexifi::Email::RFC6068 #=>
51
+
52
+ ```
53
+
54
+ ## List of REGEXP in this library
55
+ - [Emails](#emails)
56
+ - [Urls/Domains](#urls)
57
+
58
+ ### Emails
59
+
60
+ > Suggestion:
61
+ > If you want to be absolutely true to the spec, most EMAIL RFC are almost impossible to define using Regex alone.
62
+ > Or it becomes clunky and unwieldy. Here are the most common REGEXP , that are commonly used in the "wild".
63
+ >
64
+ > If you want to dive a bit more and see why using Regex is not always the best solution - check out [this blog post](https://davidcel.is/blog/2012/09/06/stop-validating-email-addresses-with-regex/)
65
+
66
+
67
+ The top two expressions will get you what you want 99% of the time
68
+
69
+ ```ruby
70
+ Regexifi::Email::DEVISE
71
+ ```
72
+
73
+ Use this if you want to allow internationalized domain names, that use non-Latin alphabet.
74
+ ```ruby
75
+ Regexifi::Email::IDN
76
+ ```
77
+
78
+ These are also used and are closer to the specs, but they do allow some emails that are for most intents and purposes "spam-y", like john.doe@127.0.0.1
79
+ ```ruby
80
+ Regexifi::Email::WHATWG
81
+ Regexifi::Email::RFC5322
82
+ Regexifi::Email::RFC6068
83
+ Regexifi::Email::RAILS_TUTORIAL
84
+ ```
85
+
86
+ Refer to [code](lib/regexifi/email.rb) and [tests](spec/email_spec.rb) for more details.
87
+
88
+
89
+ ### Urls
90
+ > Suggestion: In most cases you can use either URI.parse from Ruby's standard library or an excellent Bob Aman's Addressable gem https://github.com/sporkmonger/addressable, to much better effect
91
+
92
+ Match a domain without http(s) protocol, i.e: `https://www.example.com`
93
+ ```ruby
94
+ Regexifi::Url::DOMAIN
95
+ ```
96
+
97
+ Match the whole url with protocol, i.e: `https://example.io/article/2/comments?from=registered_users&recent=true`
98
+ ```ruby
99
+ Regexifi::Url::URL
100
+ ```
101
+ Refer to [code](lib/regexifi/url.rb) and [tests](spec/url_spec.rb) for more details.
102
+
103
+
104
+ ## Development
105
+
106
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
107
+
108
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
109
+
110
+ ## Contributing
111
+
112
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/regexifi-rb.
113
+
114
+ ## License
115
+
116
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
117
+
118
+ ## Code of Conduct
119
+
120
+ Everyone interacting in the Regexifi project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md).
@@ -0,0 +1,24 @@
1
+ require 'bundler/gem_tasks'
2
+ require "rspec/core/rake_task"
3
+
4
+
5
+
6
+ RSpec::Core::RakeTask.new(:spec) do |task|
7
+ task.rspec_opts = ['--color', '--format', 'doc']
8
+ end
9
+ task default: :spec
10
+
11
+
12
+ task :console do
13
+ require 'pry'
14
+ require 'regexifi'
15
+
16
+ def reload!
17
+ files = $LOADED_FEATURES.select { |feat| feat =~ /\/regexifi\// }
18
+ files.each { |file| load file }
19
+ puts 'Reloaded!'
20
+ end
21
+
22
+ ARGV.clear
23
+ Pry.start
24
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "regexifi"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,8 @@
1
+ require "regexifi/version"
2
+ require "regexifi/email"
3
+ require "regexifi/url"
4
+
5
+ module Regexifi
6
+ class Error < StandardError; end
7
+ # Your code goes here...
8
+ end
@@ -0,0 +1,44 @@
1
+ module Regexifi
2
+ module Email
3
+ # WARNING:
4
+ # If you want to be absolutely true to the spec, most EMAIL RFC are almost impossible to define using Regex alone.
5
+ # Or it becomes clunky and unwieldy. Here are the most common REGEXP , that are commonly used in the "wild".
6
+ # If you want a better way to parse an email - please refer to this discussion.
7
+ # https://stackoverflow.com/questions/22993545/ruby-email-validation-with-regex
8
+
9
+ # Used by a popular authentication gem Devise
10
+ DEVISE = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i.freeze
11
+
12
+ # Based on the Devise Regexp above, but actually UTF-8 / IDN friendly
13
+ # If you need to pass internationalized domains (IDN) - https://en.wikipedia.org/wiki/Internationalized_domain_name
14
+ # that use Cyrillic or Asian characters for example, this might be a better choice.
15
+ IDN = /^([[[:word:]]\.%\+\-]+)@([[[:word:]]\-]+\.)+([[:alpha:]]{2,})$/i.freeze
16
+
17
+ # This is a commonly seen in Rails apps regex from Michael's Hartl's tutorial
18
+ # IT's similar to DEVISE's default Regex with slight modification ( not allowing 1-letter TLDs)
19
+ # Original = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/ix.freeze
20
+ RAILS_TUTORIAL = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]{2,}+\z/i.freeze
21
+
22
+ # This is a standard developed by WHATWG - Web Hypertext Application Technology Working Group based on the RFC1123
23
+ # standard that defines rules for domains.
24
+ # https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
25
+ WHATWG = %r{^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+
26
+ @[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?
27
+ (?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$}ix.freeze
28
+
29
+ # RFC1123 = /\A(?<domain>(?!.{254,})((((([A-Za-z0-9])([A-Za-z0-9\-]){0,62}\.)*([A-Za-z])
30
+ # ([A-Za-z0-9\-]){0,62}))|((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}
31
+ # (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))))\Z/ix
32
+ RFC5322 = %r{\A(?<local>(([A-Za-z0-9!#\$%&'*\+\-/=\?\^_`\{\}\|~])+)(\.([A-Za-z0-9!#\$%&'*\+\-/=\?\^_`\{\}\|~])+)*)
33
+ @((?<domain>(?!.{254,})((((([A-Za-z0-9])([A-Za-z0-9\-]){0,62}\.)*([A-Za-z])([A-Za-z0-9\-]){0,62}))|
34
+ ((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)))))\Z}ix.freeze
35
+
36
+ # RFC6068 defines the whole URI spec, but for out purposes here we just need email address REGEXP,
37
+ # which currently is defined as this
38
+ # /\A[a-zA-Z0-9.!\#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?
39
+ # (?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\z/ix
40
+ # However if you don't have a compelling reason to spell it out, it is recommended to use REGEX defined in Ruby's
41
+ # standard library
42
+ RFC6068 = URI::MailTo::EMAIL_REGEXP
43
+ end
44
+ end
@@ -0,0 +1,13 @@
1
+ # If you can use either URI.parse from Ruby's standard library or
2
+ # an excellent Bob Aman's Addressable gem https://github.com/sporkmonger/addressable
3
+
4
+ module Regexifi
5
+ module Url
6
+ # Domain
7
+ # DOMAIN = /\A([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?)?)\z/ix.freeze
8
+ DOMAIN = /\A([[:alnum:]]+([\-\.]{1}[[:alnum:]]+)*\.[[:alpha:]]{2,}(([[:digit:]]{1,5})?)?)\z/ix.freeze
9
+
10
+ # URL
11
+ URL = %r{(\A\z)|(\A((http|https):\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,}(([0-9]{1,5})?\/.*)?\z)}ix.freeze
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module Regexifi
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,34 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "regexifi/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "regexifi"
8
+ spec.version = Regexifi::VERSION
9
+ spec.authors = ["Nick Gorbikoff"]
10
+ spec.email = ["nick.gorbikoff@gmail.com"]
11
+
12
+ spec.summary = %q{A collection of tested common Regex experessions. }
13
+ spec.description = %q{A collection of tested common Regex experessions. Because why re-invent the wheel every time for a new project? Don't add a bunch of adhoc Regex epxressions for common things like email addresses, urls, usernames, timeformats - Regexifi instead!}
14
+ spec.homepage = "https://github.com/konung/regexifi-rb"
15
+ spec.license = "MIT"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler"
27
+ spec.add_development_dependency "rake", "~> 12.3"
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+ spec.add_development_dependency "guard", "~> 2.1"
30
+ spec.add_development_dependency "guard-bundler"
31
+ spec.add_development_dependency "guard-rspec", "~> 4.7"
32
+ spec.add_development_dependency "guard-rubocop"
33
+ spec.add_development_dependency "pry", "~> 0.12"
34
+ end
metadata ADDED
@@ -0,0 +1,176 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: regexifi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nick Gorbikoff
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-03-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '12.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '12.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard-bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '4.7'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '4.7'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.12'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.12'
125
+ description: A collection of tested common Regex experessions. Because why re-invent
126
+ the wheel every time for a new project? Don't add a bunch of adhoc Regex epxressions
127
+ for common things like email addresses, urls, usernames, timeformats - Regexifi
128
+ instead!
129
+ email:
130
+ - nick.gorbikoff@gmail.com
131
+ executables: []
132
+ extensions: []
133
+ extra_rdoc_files: []
134
+ files:
135
+ - ".gitignore"
136
+ - ".rspec"
137
+ - ".rubocop.yml"
138
+ - ".travis.yml"
139
+ - CODE_OF_CONDUCT.md
140
+ - Gemfile
141
+ - Gemfile.lock
142
+ - Guardfile
143
+ - LICENSE
144
+ - README.md
145
+ - Rakefile
146
+ - bin/console
147
+ - bin/setup
148
+ - lib/regexifi.rb
149
+ - lib/regexifi/email.rb
150
+ - lib/regexifi/url.rb
151
+ - lib/regexifi/version.rb
152
+ - regexifi.gemspec
153
+ homepage: https://github.com/konung/regexifi-rb
154
+ licenses:
155
+ - MIT
156
+ metadata: {}
157
+ post_install_message:
158
+ rdoc_options: []
159
+ require_paths:
160
+ - lib
161
+ required_ruby_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ required_rubygems_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ requirements: []
172
+ rubygems_version: 3.0.1
173
+ signing_key:
174
+ specification_version: 4
175
+ summary: A collection of tested common Regex experessions.
176
+ test_files: []