Comment: Version 1 (substitution: '$1$2\n'):
Comment: Match 1-80 characters, backtracking as necessary until whitespace or
Comment: EOL is reached. If words > 80 characters (w/o whitespace) are found,
Comment: no wrapping is performed on that word.
Comment: [1353 steps]
Comment: (.{1,80})(?:\s|$)|(\S{81,})(?:\s|$)
Comment: Version 2 (substitution: '$1$2\n'):
Comment: Same as Version 1 but with a negative look-ahead at the front to skip
Comment: to the alternate branch sooner.
Comment: [773 steps]
Comment: (?!\S{81})(.{1,80})(?:\s|$)|(\S{81,})(?:\s|$)
Comment: Version 3 (substitution: '$1$2\n'):
Comment: Same as Version 1 but alternations swapped.
Comment: [749 steps]
Comment: (\S{81,})(?:\s|$)|(.{1,80})(?:\s|$)
Comment: Version 4 (substitution: '$1\n'):
Comment: Combine alternations into one group.
Comment: [712 steps]
\S{79,}any non-whitespace character, repeated at least 79 times
.{1,80}any character (except for line terminators), repeated between 1 and 80 times
Non-Capturing Group(?:\s|$) \sany whitespace character