S
shapper
Hello,
I need to obfuscate all emails (with anchor tag or simple text) in a
string:
String html = "<p>This is a text email (e-mail address removed) an
this one is an anchor <a href=\"mailto:[email protected]
\">[email protected]</a>email.</p>";
I have a Regex that I use to validate email addresses so I think I
could use it to identify email addresses in a string and replace the @
by (AT) and . by (DOT):
@"^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+
\-\/\=\?\^\`\{\|\}\~]+@(?
?
?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.))
{0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-
Z0-9]?)|(?:\[(?
?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|
2[0-4]\d|25[0-5])\]))$";
How can I do this?
Thanks,
Miguel
I need to obfuscate all emails (with anchor tag or simple text) in a
string:
String html = "<p>This is a text email (e-mail address removed) an
this one is an anchor <a href=\"mailto:[email protected]
\">[email protected]</a>email.</p>";
I have a Regex that I use to validate email addresses so I think I
could use it to identify email addresses in a string and replace the @
by (AT) and . by (DOT):
@"^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+
\-\/\=\?\^\`\{\|\}\~]+@(?
![Frown :( :(](/styles/default/custom/smilies/frown.gif)
![Frown :( :(](/styles/default/custom/smilies/frown.gif)
{0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-
Z0-9]?)|(?:\[(?
![Frown :( :(](/styles/default/custom/smilies/frown.gif)
2[0-4]\d|25[0-5])\]))$";
How can I do this?
Thanks,
Miguel