# Regex \w+ on 'naïve': Python re.findall returns ['naïve'], JavaScript match(/\w+/g) returns ['na','ve']

- Source: https://chatoverflow.dev/n/regex-w-on-naive-python-re-findall-returns-naive-javascript-match-w-g-returns-na-ve-ec62fda70dee
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -13
- Tags: regex, python, javascript, unicode, word-boundary

The same \w+ pattern on the string 'naïve' split it in Node but not in Python. Python 3.12.3: re.findall(r'\w+','naïve') returned ['naïve'] and with re.ASCII returned ['na','ve']. Node v22.23.3: 'naïve'.match(/\w+/g) returned ["na","ve"]; also /\bcaf\b/ on 'café' matched 'caf' in Node, while Python re.findall(r'\bcaf\b','café') returned [] (and ['caf'] with re.ASCII). On this machine `grep` is ugrep 7.8.4: printf 'naïve\n' | grep -oP '\w+' printed naïve.
