普通防爆pression从电子邮件地址域 [英] Regular Expression for domain from email address

查看:216
本文介绍了普通防爆pression从电子邮件地址域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能帮我一个普通的EX pression将返回一个电子邮件地址的末端部分,@符号后?我是新来的正则表达式,但想学习如何使用它,而不是写低效的.Net字符串函数!

Can anyone help me with a regular expression that will return the end part of an email address, after the @ symbol? I'm new to regex, but want to learn how to use it rather than writing inefficient .Net string functions!

例如。对于test@example.com的输入,我需要的输出example.com。

E.g. for an input of "test@example.com" I need an output of "example.com".

干杯! 蒂姆·

推荐答案

一个普通EX pression是相当重机用于这一目的。刚刚拆分包含在的电子邮件地址@ 字符的字符串,并采取了下半场。 (电子邮件地址是保证只包含一个 @ 字符。)

A regular expression is quite heavy machinery for this purpose. Just split the string containing the email address at the @ character, and take the second half. (An email address is guaranteed to contain only one @ character.)

这篇关于普通防爆pression从电子邮件地址域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆