Removing long words from a string
Posted: Mon Aug 09, 2004 5:50 am
Come across a problem on one of my sites with a feed. One of my users has put in a post where for the purposes of underlining she has put in umpteen "-" characters (where one <hr> would have sufficed, alas). As a result of this the format on the front page is temporarily knocked out of alignment.
This data is held within a MySql database, and a number of conditions are put on the parsed text already, e.g. strip_tags.
What would be the best answer to this problem?
So far I've considered:
1) Cheating by using the wordwrap command.
2) Cheating by using ereg_replace or preg_replace to take the "-" character out of the feed.
But I figure there must be a better way to do this, just haven't been able to find it. Can anyone suggest one?
P.S. I would probably make a limit of twenty characters to a word, that seems a reasonable amount.
This data is held within a MySql database, and a number of conditions are put on the parsed text already, e.g. strip_tags.
What would be the best answer to this problem?
So far I've considered:
1) Cheating by using the wordwrap command.
2) Cheating by using ereg_replace or preg_replace to take the "-" character out of the feed.
But I figure there must be a better way to do this, just haven't been able to find it. Can anyone suggest one?
P.S. I would probably make a limit of twenty characters to a word, that seems a reasonable amount.