Last active
August 29, 2015 14:07
-
-
Save bayendor/620534f15b02cab6a93a to your computer and use it in GitHub Desktop.
Turing RegEx Cleaner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cleaner | |
def domain_from_email(email) | |
email.match(/([\w+\-.]+)@([a-z\d\-.]+\.[a-z]{2,4}+)/)[2] | |
end | |
def area_code_only(phone_number) | |
phone_number.match(/(\+*\d{1,})*([ |\(])*(\d{3})[^\d]*(\d{3})[^\d]*(\d{4})/)[3] | |
end | |
def get_secret_message(string) | |
string.gsub(/([^a-z ])/i, "").downcase | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment