# Stripping HTML from an ASP code and then Trimming It

**URL:** <https://forum.kirupa.com/t/stripping-html-from-an-asp-code-and-then-trimming-it/314157>\
**Category:** programming\
**Created:** [September 20, 2010, 3:25pm UTC](https://forum.kirupa.com/t/stripping-html-from-an-asp-code-and-then-trimming-it/314157 "2010-09-20T15:25:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmykup](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jimmykup](https://forum.kirupa.com/u/jimmykup)\
**Post date:** [September 20, 2010, 3:25pm UTC](https://forum.kirupa.com/t/stripping-html-from-an-asp-code-and-then-trimming-it/314157/1 "2010-09-20T15:25:48Z")

</div>

Hello,

To start off I would like to say that I have very little experience in dealing with classic ASP. My specialty is HTML and CSS so I’m a little bit lost here. Hopefully someone here can lend me a hand.

**My Goal:**  
My company sells projectors and other AV equipment. I would like to take the product descriptions that appear on the individual product pages and use them in my META tags and Facebook OpenGraph tags.

**The Problem:**  
The product descriptions are saved in our database as text with HTML tags in it. I need these descriptions to load into my HTML as plain text without HTML elements or styling.

**Here’s what I would like to do:**  
**1.** Strip HTML tags from a body of text.  
**2.** Trim that text to a pre-determined length or after a certain amount of sentences.

Here is the ASP tag in my HTML that loads the product description. And [here is an example](http://www.iavi.com/itemdesc_social3.asp?ic=plcxp200l) of one of the pages it loads into.

```auto
<%=sDescription%>

```

I searched for a code that would help me with removing the HTML tags and I found this piece right here.

```auto

Function stripTags(HTMLstring)
    Set RegularExpressionObject = New RegExp
    With RegularExpressionObject
        .Pattern = "<[^>]+>"
        .IgnoreCase = True
        .Global = True
    End With
    stripTags = RegularExpressionObject.Replace(HTMLstring, "")
    Set RegularExpressionObject = nothing
End Function

```

But I don’t know how to get that code to interact with my code. I’m familiar with Regular Expressions so I understand how this code does what it does. Unfortunately I don’t understand anything else about it. I’ve tried replacing “HTMLstring” with my code but that didn’t do anything.

If this code isn’t enough, there’s plenty of more code in my source that I can supply you with. Just tell me what I should be looking for. Any help would be greatly appreciated, thank you! 🙂
