in reply to Using a regex to catch interpreters
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using a regex to catch interpreters
by ikegami (Patriarch) on Jul 06, 2005 at 06:52 UTC |