Hi,
I am a RegExp newbie, and need help with this:
i have a long string (500 / 600 chars), and need to split it in lines.

Each line has a maximum length (20), and words in the line shouldn't be
 cut, instead the line should end at the end of the word whose last
char position is <= 20.

the effect is like a left align in a word processor, where lines wrap at
20, and the words are not cut.

example:

string= "aaaaa bbbbb ccccc ddddd eeeee ffffffffff ggggg"
(char)            1111111111222222222233333333334444444
         1234567890123456789012345678901234567890123456


regexp should output:


"aaaaa bbbbb ccccc
 ddddd eeeee
 ffffffffff ggggg"


Is it a sensible thing to do this job with regExp or is it better to use the usual string functions?

Thanx

moondog

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to