K
Kerry
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.
How might this be altered to avoid missing the last word?
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.
How might this be altered to avoid missing the last word?