ruby_regex 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -1
- data/README.rdoc +3 -1
- data/lib/ruby_regex.rb +4 -0
- data/test/ruby_regex_test.rb +8 -0
- metadata +21 -41
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
27/09/2011
|
2
|
+
-------------------------
|
3
|
+
Add UUID regexp
|
4
|
+
|
1
5
|
29/09/2010
|
2
6
|
-------------------------
|
3
7
|
Fix bug in email regexp
|
@@ -18,4 +22,4 @@ Add RubyRegex::CreditCard
|
|
18
22
|
|
19
23
|
-------------------------
|
20
24
|
Add RubyRegex::Username
|
21
|
-
Add RubyRegex::Dni
|
25
|
+
Add RubyRegex::Dni
|
data/README.rdoc
CHANGED
@@ -18,6 +18,7 @@ RubyRegex is a nice collection of regular expressions in Ruby
|
|
18
18
|
RubyRegex::DeliciousUsername
|
19
19
|
RubyRegex::SlidesahreUsername
|
20
20
|
RubyRegex::GithubUsername
|
21
|
+
RubyRegex::UUID
|
21
22
|
|
22
23
|
== Rails
|
23
24
|
|
@@ -39,7 +40,8 @@ If you want to contribute send me a pull request with new regular expressions (a
|
|
39
40
|
- Lleïr Borràs
|
40
41
|
- Jaime Iniesta
|
41
42
|
- Fernando Guillen
|
43
|
+
- Christopher Klapp
|
42
44
|
|
43
45
|
---
|
44
46
|
|
45
|
-
RubyRegex is released under the MIT-License and is Copyright (c)2010 Emili Parreño.
|
47
|
+
RubyRegex is released under the MIT-License and is Copyright (c)2010 Emili Parreño.
|
data/lib/ruby_regex.rb
CHANGED
@@ -49,4 +49,8 @@ module RubyRegex
|
|
49
49
|
# From the email regex research: http://fightingforalostcause.net/misc/2006/compare-email-regex.php
|
50
50
|
# Authors: James Watts and Francisco Jose Martin Moreno
|
51
51
|
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
|
52
|
+
|
53
|
+
# UUID
|
54
|
+
# Validates a UUID as defined: http://en.wikipedia.org/wiki/Universally_unique_identifier
|
55
|
+
UUID = /^(\h{32}|\h{8}-\h{4}-\h{4}-\h{4}-\h{12})$/
|
52
56
|
end
|
data/test/ruby_regex_test.rb
CHANGED
@@ -123,6 +123,14 @@ class RubyRegexTest < ActiveSupport::TestCase
|
|
123
123
|
check_invalid_regex RubyRegex::DeliciousUsername, ['nickel 84', 'h.ppywebcoder']
|
124
124
|
end
|
125
125
|
|
126
|
+
def test_valid_uuids
|
127
|
+
check_valid_regex RubyRegex::UUID, ['550e8400e29b41d4a716446655440000', '550e8400-e29b-41d4-a716-446655440000', '6ba7b8109dad11d180b400c04fd430c8', '6ba7b810-9dad-11d1-80b4-00c04fd430c8']
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_invalid_uuids
|
131
|
+
check_invalid_regex RubyRegex::UUID, ['6ba7b810-9dad-11d180b400c04fd430c8', 'zba7b810-9dad-11d1-80b4-00c04fd430c8', '6ba7b81-9ad-1d1-0b4-00c04fd430c8', '1234', 'asdf', '555-555-5555', 'abcd@qwerty.com']
|
132
|
+
end
|
133
|
+
|
126
134
|
private
|
127
135
|
def load_fixture( name )
|
128
136
|
YAML.load( File.read( File.join( File.dirname(__FILE__), 'fixtures', "#{name}.yml" ) ) )
|
metadata
CHANGED
@@ -1,74 +1,54 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_regex
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 7
|
10
|
-
version: 0.0.7
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.8
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Emili Parreno
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2010-09-29 00:00:00 +02:00
|
19
|
-
default_executable:
|
12
|
+
date: 2011-09-27 00:00:00.000000000Z
|
20
13
|
dependencies: []
|
21
|
-
|
22
14
|
description: Ruby regular expressions library
|
23
15
|
email: emili@eparreno.com
|
24
16
|
executables: []
|
25
|
-
|
26
17
|
extensions: []
|
27
|
-
|
28
18
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
19
|
+
files:
|
31
20
|
- CHANGELOG
|
32
21
|
- README.rdoc
|
33
22
|
- LICENSE
|
34
23
|
- lib/ruby_regex.rb
|
35
24
|
- test/ruby_regex_test.rb
|
36
25
|
- test/fixtures/emails.yml
|
37
|
-
has_rdoc: true
|
38
26
|
homepage: http://github.com/eparreno/ruby_regex
|
39
27
|
licenses: []
|
40
|
-
|
41
28
|
post_install_message:
|
42
|
-
rdoc_options:
|
29
|
+
rdoc_options:
|
43
30
|
- --main
|
44
31
|
- README
|
45
|
-
require_paths:
|
32
|
+
require_paths:
|
46
33
|
- lib
|
47
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
35
|
none: false
|
49
|
-
requirements:
|
50
|
-
- -
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
|
53
|
-
|
54
|
-
- 0
|
55
|
-
version: "0"
|
56
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
41
|
none: false
|
58
|
-
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
segments:
|
63
|
-
- 0
|
64
|
-
version: "0"
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
65
46
|
requirements: []
|
66
|
-
|
67
47
|
rubyforge_project:
|
68
|
-
rubygems_version: 1.
|
48
|
+
rubygems_version: 1.8.6
|
69
49
|
signing_key:
|
70
50
|
specification_version: 3
|
71
51
|
summary: none
|
72
|
-
test_files:
|
52
|
+
test_files:
|
73
53
|
- test/ruby_regex_test.rb
|
74
54
|
- test/fixtures/emails.yml
|