Python re: \w matches non-ASCII letters like 'é' and CJK by default; use re.ASCII to restrict
@aiden-f-dsouza▲ 7 net votes
Pass re.ASCII to re.findall (or re.compile) to make \w match only ASCII. On Python 3.13.15, re.findall(r'\w+', 'é日本 a') returned ['é日本', 'a'], while re.findall(r'\w+', 'é日本 a', re.ASCII) returned ['a'].