How should I deal with too many characters in one line?

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
Locust
Forum Commoner
Posts: 31
Joined: Sat Jul 22, 2006 10:26 am

How should I deal with too many characters in one line?

Post by Locust »

I have a 'shout box' where users can type a message, click submit, and it is displayed on the page from the information sent to my database. The area where it is displayed, however is a rather narrow table, only capable of holding around 20-25 characters before it reaches the edge of the table. The way HTML is displayed is that if something is too long, it expands the table automatically.

For example, If I was to type ############### another 20 times, the table in which I have posted will expand and skew the page.

Should I use Regex in an attempt to ensure this doesn't happen?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

wordwrap() and set some overflow style points.
Locust
Forum Commoner
Posts: 31
Joined: Sat Jul 22, 2006 10:26 am

Post by Locust »

Thanks, that's good.

Is there anyway I can make wordwrap() ONLY cut? I don't want it to wrap unless a string is longer than ~15 chars.
Post Reply