c# - format string email to email-link -


I have a blank-string email, and I would like to format the string as a mail link if it is valid .

Like this:

  & lt; A href = "mailto: foo@foo.com" & gt; Foo@foo.com< / A & gt;  

How is this done?

/ m

email address (string email address) {Regex emailRegex = new Regex ("^ (?!! *.) [A-zA-Z0-9 \ w \ ._% &! * * = ^ + - ?.] * @ [One- ZA-Z0-9] [\ w \ .-] * [one-zA-Z0-9] * \ [a-zA-Z] [ZA-Z to one.] * [A-zA-Z] $ "; If (emailRegex.IsMatch (email address) {return string format (" & lt; a href = \ "mailto: {0} \" & gt; {0} & lt; / a & gt; " Email address);} return "";}

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -