Tuesday, April 6, 2010

Clean up html code and words tag in .NET

Private Shared Function CleanHTML(ByVal html As String) As String
html = Regex.Replace(html, "<[/]?(font|span|xml|del|ins|[ovwxp]:\w+)[^>]*?>", "", RegexOptions.IgnoreCase)
html = Regex.Replace(html, "<([^>]*)(?:class|lang|style|size|face|[ovwxp]:\w+)=(?:'[^']*'|""[^""]*""|[^\s>]+)([^>]*)>", "<$1$2>", RegexOptions.IgnoreCase)
html = Regex.Replace(html, "<([^>]*)(?:class|lang|style|size|face|[ovwxp]:\w+)=(?:'[^']*'|""[^""]*""|[^\s>]+)([^>]*)>", "<$1$2>", RegexOptions.IgnoreCase)
Return html
End Function

5 comments:

Anonymous said...

What is the use of this code?

Bak said...

thanks for your sharing! great helpful!!!Louboutin Shoes Christian Louboutin ShoesChristian Louboutin Pumps Wedding Dress ShopsWedding Dress ShopsChristian Louboutin Boots Christian Louboutin PumpsChristian Louboutin Heels Christian Louboutin SandalPigalle Christian Louboutin fur bootschristian louboutin fur bootslouboutin pumpslouboutin fur bootscoyote fur bootschristian louboutin heelssilver strappy sandalschristian louboutin toundraloubitan studded bow peepvintage wedding dresses wedding dressescheap mobile phoneWedding Dresses 2011Wedding Dress ShopsOff the Shoulder Wedding Dressesbridal jacketswedding jacketsbridal jacketshalter neck wedding dressesoff the shoulder wedding dressesvintage wedding dresseswedding dresses with sleeveswedding jackets for the brideSorry for the bother, God bless you.

Anonymous said...

視訊,免費視訊,視訊聊天美女,視訊美女聊天,視訊聊天網


視訊美女一對一,視訊聊天俱樂部,視訊聊天戀愛ing,視訊pcgirl,視訊美女超級賣

Anonymous said...

top [url=http://www.001casino.com/]casino[/url] check the latest [url=http://www.realcazinoz.com/]casino bonus[/url] free no set aside bonus at the foremost [url=http://www.baywatchcasino.com/]redeem casino
[/url].

International Toll Free Number said...

Fabulous, what a website it iѕ! This web ѕite ρresents valuable information to us, κeep it up.