July 5, 2007 by aliraza
use this function
public string Strip(string text) { return Regex.Replace(text, @”<(.|\n)*?>”, string.Empty); }
Possibly related posts: (automatically generated)
Posted in .net framework 2, asp.net 2 | 27 Comments
Thanks Ali Raza, This post really helped me.
Thanks once again, Let me know if i could help you in any regard.
Thanks a lot Ali Raza .A simple and amazing solution to my problem.
Perfect! Very useful!
thank you very much aliraza. very helpful tip.
some another way:
public static string StripHtml(string html, bool allowHarmlessTags) { if (html == null || html == string.Empty) return string.Empty; if (allowHarmlessTags) return System.Text.RegularExpressions.Regex.Replace(html, "", string.Empty); return System.Text.RegularExpressions.Regex.Replace(html, "<[^>]*>", string.Empty); }
[...] article source [...]
thanks. this is very usefull
Thank you very much!! This has been hassling me for 2days and you put an end to it! Thanks again!
Thanks a lot, its a gr8 help to my problem.
Great. Thumbs Up
thanks Ali, simple solution…. nice
Thanks Aliraza. It really helps me…
To remove only particular tag:
http://urenjoy.blogspot.com/2008/10/remove-html-tags-from-string.html
Thanks Ali Raza …Very help ful
Remember to clean out things like ‘ ’ or replace them with their plain text value if you are trying to get a plain text string. This regex doesn’t handle those.
Great tip. Worked well for getting at the text in links that may or may not have images inside the tags.
Thanks Ali Raza …Very nice..
Very good solution. Great thinking
Aces that Ali – great solution
salam tanx . very nice and interesting.
VERY GOOD SOLUTION tHANKS ALI….
Great! One line of code and it saves lots of time
Thanks aliraza
just perfect!
Thank so much.
a very useful article, 10x
Thanks aliraza, it very halpfull to me
Comments RSS
Name (required)
E-mail (will not be published) (required)
Website
Notify me of follow-up comments via email.
Notify me of new posts via email.
Thanks Ali Raza, This post really helped me.
Thanks once again, Let me know if i could help you in any regard.
Thanks a lot Ali Raza .A simple and amazing solution to my problem.
Perfect! Very useful!
thank you very much aliraza. very helpful tip.
some another way:
public static string StripHtml(string html, bool allowHarmlessTags){
if (html == null || html == string.Empty)
return string.Empty;
if (allowHarmlessTags)
return System.Text.RegularExpressions.Regex.Replace(html, "", string.Empty);
return System.Text.RegularExpressions.Regex.Replace(html, "<[^>]*>", string.Empty);
}
[...] article source [...]
thanks.
this is very usefull
Thank you very much!! This has been hassling me for 2days and you put an end to it! Thanks again!
Thanks a lot, its a gr8 help to my problem.
Great. Thumbs Up
thanks Ali, simple solution…. nice
Thanks Aliraza.
It really helps me…
To remove only particular tag:
http://urenjoy.blogspot.com/2008/10/remove-html-tags-from-string.html
Thanks Ali Raza …Very help ful
Remember to clean out things like ‘ ’ or replace them with their plain text value if you are trying to get a plain text string. This regex doesn’t handle those.
Great tip. Worked well for getting at the text in links that may or may not have images inside the tags.
Thanks Ali Raza …Very nice..
Very good solution. Great thinking
Aces that Ali – great solution
salam
tanx . very nice and interesting.
VERY GOOD SOLUTION tHANKS ALI….
Great!
One line of code and it saves lots of time
Thanks aliraza
just perfect!
Thank so much.
a very useful article, 10x
Thanks aliraza,
it very halpfull to me