Update: The following modification to the regex eliminates the need for the s/\s+$// for @lines; above (works because \s includes newline):
I still plead for keeping the \W, best with non-greedifier i.e. \W?, so a final punctuation or hyphen is captured even though the limit is exceeded by one.
In reply to Re^2: Split string using regex on \n or max line length (updated)
by flowdy
in thread Split string using regex on \n or max line length
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |