I see three problems:
1)The [^>] in (?=[^>]*\n) can match newlines.
2) ">" isn't allowed anywhere on the ">>>" line (after the ">>>"). Is that intentional?
3) The second negative lookahead is currently anchored to the character right after the ">>>", not to the start of the next line.
Fixes:
s/ (?<!^>>[^>]) ^>>> (?= [^\n]*\n # <-- removed < and added first \n (?!^>>[^>]) # <-- moved into (?=...) ) /PYTHON_PROMPT/xmg;
Updated
In reply to Re: Using a regex to catch interpreters
by ikegami
in thread Using a regex to catch interpreters
by eastcoastcoder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |