How to get domain from email

后端 未结 3 375
-上瘾入骨i
-上瘾入骨i 2021-02-02 07:15

How do I get the domain from an email-adress in ruby?

3条回答
  •  终归单人心
    2021-02-02 07:57

    If you prefer using a library dedicated to understanding these things:

    → irb -rmail
    ruby-1.9.2-p0 > Mail::Address.new('feep+wibble@example.com').domain
     => "example.com" 
    

提交回复
热议问题