Skip to content

Instantly share code, notes, and snippets.

@bayendor
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bayendor/620534f15b02cab6a93a to your computer and use it in GitHub Desktop.
Save bayendor/620534f15b02cab6a93a to your computer and use it in GitHub Desktop.
Turing RegEx Cleaner
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