ruby_regex 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +5 -0
- data/README.rdoc +1 -0
- data/lib/ruby_regex.rb +32 -32
- metadata +2 -2
data/CHANGELOG
CHANGED
data/README.rdoc
CHANGED
data/lib/ruby_regex.rb
CHANGED
@@ -1,56 +1,56 @@
|
|
1
1
|
module RubyRegex
|
2
2
|
# Username
|
3
3
|
# This regular expression doesn't validate username's length
|
4
|
-
Username =
|
5
|
-
|
4
|
+
Username = /\A[a-zA-Z0-9_]*\z/
|
5
|
+
|
6
6
|
# Dni (spanish ID card)
|
7
|
-
Dni =
|
8
|
-
|
7
|
+
Dni = /\A\d{8}[A-Za-z]{1}\z/
|
8
|
+
|
9
9
|
# URL
|
10
|
-
Url = URL = /(
|
11
|
-
|
10
|
+
Url = URL = /(\A\z)|(\A(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?\z)/ix
|
11
|
+
|
12
12
|
# Domain
|
13
|
-
Domain = /(
|
14
|
-
|
13
|
+
Domain = /(\A\z)|(\A[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?)?\z)/ix
|
14
|
+
|
15
15
|
# CreditCard
|
16
16
|
# Validates Credit Card numbers, Checks if it contains 16 numbers in groups of 4 separated by -, space or nothing
|
17
|
-
CreditCard =
|
18
|
-
|
17
|
+
CreditCard = /\A(\d{4}-){3}\d{4}\z|\A(\d{4}\s){3}\d{4}\z|\A\d{16}\z/
|
18
|
+
|
19
19
|
# MasterCard credit card
|
20
|
-
MasterCard =
|
21
|
-
|
20
|
+
MasterCard = /\A5[1-5]\d{14}\z/
|
21
|
+
|
22
22
|
# Visa credit card
|
23
|
-
Visa =
|
24
|
-
|
23
|
+
Visa = /\A4\d{15}\z/
|
24
|
+
|
25
25
|
# US Social Security
|
26
|
-
USSocialSecurity =
|
27
|
-
|
26
|
+
USSocialSecurity = /\A\d{3}-\d{2}-\d{4}\z/
|
27
|
+
|
28
28
|
# General postal code
|
29
29
|
# Validates a 5 digits postal code
|
30
|
-
GeneralPostalCode =
|
31
|
-
|
30
|
+
GeneralPostalCode = /\A\d{5}\z/
|
31
|
+
|
32
32
|
# US ZIP code
|
33
33
|
# Validates US ZIP Code (basic and extended format)
|
34
|
-
ZIPCode =
|
35
|
-
|
34
|
+
ZIPCode = /\A(\d{5}\z)|(\d{5}-\d{4}\z)/
|
35
|
+
|
36
36
|
# Twitter username
|
37
|
-
TwitterUsername =
|
38
|
-
|
37
|
+
TwitterUsername = /\A([a-z0-9\_])+\z/ix
|
38
|
+
|
39
39
|
# Github username
|
40
|
-
GithubUsername =
|
41
|
-
|
40
|
+
GithubUsername = /\A([a-z0-9\_\-])+\z/ix
|
41
|
+
|
42
42
|
# Slideshare username
|
43
|
-
SlideshareUsername =
|
44
|
-
|
43
|
+
SlideshareUsername = /\A([a-z0-9])+\z/ix
|
44
|
+
|
45
45
|
# Del.icio.us username
|
46
|
-
DeliciousUsername =
|
47
|
-
|
46
|
+
DeliciousUsername = /\A([a-z0-9\_\-])+\z/ix
|
47
|
+
|
48
48
|
# Email
|
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
|
-
Email =
|
52
|
-
|
51
|
+
Email = /\A([\w\!\#\z\%\&\'\*\+\-\/\=\?\\A\`{\|\}\~]+\.)*[\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})?)\z/i
|
52
|
+
|
53
53
|
# UUID
|
54
54
|
# Validates a UUID as defined: http://en.wikipedia.org/wiki/Universally_unique_identifier
|
55
|
-
UUID =
|
56
|
-
end
|
55
|
+
UUID = /\A(\h{32}|\h{8}-\h{4}-\h{4}-\h{4}-\h{12})\z/
|
56
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_regex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-30 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: Ruby regular expressions library
|
15
15
|
email: emili@eparreno.com
|