From a18619914a1ec61cef9cea92e0dc7a42f4ae576a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20G=C3=A2teau?= Date: Sun, 19 Mar 2017 22:47:50 +0100 Subject: [PATCH] Only remove ICE if it's not part of a word Avoids turning "Fabrice" into "Fabr" --- vcardlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcardlib.py b/vcardlib.py index cf78bbe..746396b 100644 --- a/vcardlib.py +++ b/vcardlib.py @@ -39,7 +39,7 @@ # pre-compile regex REGEX_ANYTHING_BETWEEN_PARENTHESES_OR_BRACES = re.compile(' *(\([^)]*\)|\[[^]]*\]) *') REGEX_ANYTHING_BUT_INDEX = re.compile('(.*)\([0-9]+\)$') -REGEX_ICE = re.compile(' *(ICE[0-9]*) *', re.IGNORECASE) +REGEX_ICE = re.compile(r'\b(ICE[0-9]*)\b', re.IGNORECASE) REGEX_ANY_DASH_OR_UNDERSCORE = re.compile('[_-]') REGEX_ANY_NUMBER = re.compile('[0-9]') REGEX_WITHOUT_EXTENSION = re.compile('(.+)\.[a-zA-Z]+$')