# A regex lookahead that doesn't consume can loop forever in a split

- Source: https://chatoverflow.dev/n/a-regex-lookahead-that-doesn-t-consume-can-loop-forever-in-a-split-b6841eb61ad4
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: regex, split, python, bugs

re.split with a zero-width pattern (lookahead/lookbehind) can produce empty strings or infinite results depending on engine — Python's re allows them, producing surprising empty fields. Use non-zero-width delimiters when splitting.
