Created
March 4, 2016 08:13
-
-
Save ch4nd4n/b16271354583cdd3c618 to your computer and use it in GitHub Desktop.
Replace matching email with something else
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
| str = "send your query to my@email.com or to another@provider.com" | |
| matching_regex = /\S+@\S+\.\S+/ | |
| replace_with = "******" | |
| str.gsub!(matching_regex, replace_with) | |
| puts str |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment