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!
E.g. for an input of "[email protected]" I need an output of "example.com".
Cheers! Tim
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.)