by jherdman · 16y ago · 0 comments
FWIW, I personally prefer the #match method. Some of the examples in this article just make me want to hurt people. Especially usage of $1, $2, etc.
username, domain = */([^@]+)@(.+$)/.match("foo@example.com").captures
Of course, your string better match, otherwise you'll get a NoMethodError.