mirror of
https://github.com/python/cpython.git
synced 2025-10-06 23:21:06 +00:00
Issue #4163: textwrap module: allow word splitting on a hyphen preceded by a non-ASCII letter.
This commit is contained in:
parent
d9c03e0da3
commit
7c59bc6f2f
3 changed files with 12 additions and 1 deletions
|
@ -76,7 +76,7 @@ class TextWrapper:
|
|||
# (after stripping out empty strings).
|
||||
wordsep_re = re.compile(
|
||||
r'(\s+|' # any whitespace
|
||||
r'[^\s\w]*\w+[a-zA-Z]-(?=\w+[a-zA-Z])|' # hyphenated words
|
||||
r'[^\s\w]*\w+[^0-9\W]-(?=\w+[^0-9\W])|' # hyphenated words
|
||||
r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash
|
||||
|
||||
# This less funky little regex just split on recognized spaces. E.g.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue