Have you ever wanted to strip all of the HTML tags from a string? There are many reasons you may want to do this. For example, if you provide a feature on your site where a user can have the contents of a Web page emailed to them, you may wish to strip all of the HTML tags from the particular article for those users whose email client does not support HTML-formatted email. (For more information on sending emails via ASP be sure to check out the Email FAQ Category.)
Stripping HTML tags is a breeze using regular expressions. Using the regular expression pattern:
will match all < and > tags that have one or more characters inbetween them. The non-greedy operator (?) ensures that the matches will occur where there are the fewest number of characters between the < and > tags. With this regular expression pattern, once we find all of the matches we need but use the Replace method to replace them with an empty string ("").
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.