On Mon, Feb 21, 2005, Karl Chen wrote:
>
> A slightly tweaked wordsep_re:
> textwrap.TextWrapper.wordsep_re = \
> re.compile(r'(\s+|' # any whitespace
>r'[^\s\w]*\w+[a-zA-Z]-(?=[a-zA-Z]\w+)|' # hyphenated words
>r'(?<=[\w\!\"\'\&\
Hi,
textwrap.fill() is awesome.
Except when the string to wrap contains dates -- which I would
like not to be broken. In general I think wordsep_re can be
smarter about what it decides are hyphenated words.
For example, this code:
print textwrap.fill('aa 2005-02-21', 18)
produces: