views:

40

answers:

1

How-to strip email and phone numbers from html input ?

Before: "please contact me at [email protected] or email[at]email.com or by phone at 555 555 555"

After: "please contact me at [Replacement] or [Replacement] or by phone at [Replacement]"

+1  A: 

Never use Regular expressions to parse HTML. See this classic SO answer to see why.

You can parse the HTML using the HTML Agility Pack and once parsed this way you can use regular expressions to strip out the data you do not want.

Oded
ok, but how to strip out emails and phone numbers using HTML Agility Pack so ?
Yoann. B