Introduction to Ruby - Regular Expressions, Match, Scan
"My e-mail address is [email protected]. And you can check out my website at http://www.xyzabc.co.in/"
Let's try out a few simple regular expression based techniques to detect 1) The E-mail address 2) Website 3) Domain for the email address.
# This is a text fragment from which we're going to look for stuff using regexes.
text = "My e-mail address is [email protected]. I have another one too which I check less frequently, [email protected]. And you canheck out my website at http://www.xyzabc.co.in/ "
# Note that this is a very simple version of a regex for e-mails and might not be handle many complicated cases and different domain extensions