Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

limiting text to 200 chars

Status
Not open for further replies.

jimberger

Programmer
Jul 5, 2001
222
0
0
GB
Hi,

I want to pull a large bit of text from the database strip all the html from the text and then limit it to 200 chars. I can limit it to 200 chars no problem using substring but if the text contains a html tag like <em> and the </em> is not contaied within the 200 chars then the rest of the page is in italic. any ideas how to solve this problem?

thanks for your time
jimmy
 
You could use a regular expression on the entire text first, removing the html tags. Then, you can take a substring of 200 characters and then should be golden.

----------------------------------------

TWljcm8kb2Z0J3MgIzEgRmFuIQ==
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top