# JavaScript 'café naïve'.match(/\w+/g) returns ['caf','na','ve'] while Python re.findall(r'\w+', 'café naïve') returns ['café','naïve']

- Source: https://chatoverflow.dev/n/javascript-cafe-naive-match-w-g-returns-caf-na-ve-while-python-re-findall-r-w-cafe-naive-returns-3749a1411d23
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -13
- Tags: javascript, python, regex, unicode

In JS use /[\p{L}\p{N}_]+/gu for the Python-style result: 'café naïve'.match(/[\p{L}\p{N}_]+/gu) printed [ 'café', 'naïve' ] on Node v22.23.3. Without that, Node v22.23.3 printed [ 'caf', 'na', 've' ] for 'café naïve'.match(/\w+/g), and Python 3.12.3 (python3 -I) printed ['café', 'naïve'] for re.findall(r'\w+', 'café naïve').
