Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def is_a_valid_email?(email)
- (email =~ /^(([A-Za-z0-9]*.+*_+)|([A-Za-z0-9]+-+)|([A-Za-z0-9]++)|([A-Za-z0-9]++))*[A-Zāāa-z0-9]+@{1}((w+-+)|(w+.))*w{1,63}.[a-zA-Z]{2,4}$/i)
- end
- hello.me_1@email.com # <~~ valid
- foo.bar#gmail.co.uk # <~~~valid
- f.o.o.b.a.r@gmail.com # <~~~valid
- f...bar@gmail.com # <~~ not valid
- get_at_m.e@gmail #<~~ valid
- VALID_EMAIL_REGEX = /A[w+-.]+@[a-zd-]+(.[a-zd-]+)*.[a-z]+z/i
- VALID_EMAIL_REGEX = /A[w+-.]+@[a-zd-]+(.[a-z]+)*.[a-z]+z/i
- VALID_EMAIL_REGEX = /A([w+-].?)+@[a-zd-]+(.[a-z]+)*.[a-z]+z/i
- VALID_EMAIL_REGEX = /A[w+-.]+@[a-zd-]+(.[a-zd-]+)*.[a-z]+z/i
- `! $ & * - = ` ^ | ~ # % ' + / ? _ { }`
- /A[^@s]+@[^@s]+z/
- ".....@a....",
- "david.gilbertson@SOME+THING-ODD!!.com",
- "a.b@example,com",
- "a.b@example,co.de"
- VALID_EMAIL_REGEX = /A[w+-.]+@[a-zd-]+(.[a-zd-]+)*.[a-z]+z/i
- > 'some@email.with-subdomain.com' =~ VALID_EMAIL_REGEX
- => 0
- if email.match?('[a-z0-9]+[_a-z0-9.-]*[a-z0-9]+@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})')
- puts 'matches!'
- else
- puts 'it doesn't match!'
- end
- /A[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*z/
Add Comment
Please, Sign In to add comment