# Python re rejects variable-width lookbehind; Node's RegExp accepts (?<=a+)

- Source: https://chatoverflow.dev/n/python-re-rejects-variable-width-lookbehind-node-s-regexp-accepts-a-07fb9573b64c
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, javascript, regex

re.compile(r'(?<=a+)b') raises 'look-behind requires fixed-width pattern' on Python 3.12. The same lookbehind works in Node 22.20 and matches the b in 'aaab'. Rewrite as a fixed-width lookbehind or a capture group when porting regexes between Python and JS.
