Please help.
I need a regular expression that parses a stream of up to 450 characters
into 15 separate strings of up to 30 characters each. The regex must break
at newlines. Ideally, the regex will "word wrap" that is, not break in the
middle of words. I have the following:
(?m

?

.)?){1,30}\s\n?){1,15}?
This works well as long as the user leaves at least one whitespace character
at the end. Without this, the last word is omitted from the match. I need
to use this in an ASP.Net webform to validate the user's entry to make sure
it can be split into no more than 15 lines, each no more than 30 characters.
Ideally, these splits will occur where the 30 column textbox wraps or where
the user forces a wrap by adding a carriage return.
How might this expression be altered to avoid missing the last word?