Change default word regexp to exclude punctuation

This commit is contained in:
Kovid Goyal 2026-03-04 09:20:53 +05:30
parent 1785873835
commit d15905c918
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -76,11 +76,11 @@ def main(args: list[str]) -> None:
'''
)
opt('word_regex', r'\S+',
opt('word_regex', r'[^\s\p{P}]+',
long_text='''
The regular expression used to define a word when :opt:`word_diff_mode` is
:code:`words`. The default value of :code:`\\S+` matches any run of
non-whitespace characters. The expression must be a valid Go regular expression.
:code:`words`. The default value matches any run of non-whitespace and
non-punctuation characters. The expression must be a valid Go regular expression.
If an invalid expression is provided, diff will fail with an error.
'''
)