diff --git a/src/mpl_extra/AutofitText.py b/src/mpl_extra/AutofitText.py index fa09fd6..935627b 100644 --- a/src/mpl_extra/AutofitText.py +++ b/src/mpl_extra/AutofitText.py @@ -306,7 +306,7 @@ def _split_words(self, txt): """Split a hybrid sentence with some CJK characters into a list of words, keeping the English words not to be broken. """ - regex = r"[\u4e00-\ufaff]|[0-9]+|[a-zA-Z]+\'*[a-z]*" + regex = r"[\u4e00-\ufaff]|[0-9]+(?:\.[0-9]+)?%?|[a-zA-Z]+\'*[a-z]*" matches = re.findall(regex, txt, re.UNICODE) return matches