eastcoastcoder has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to use a regex to catch the >>> of Python's interpreter, but ignore any lines beginning with >>> if preceeded or followed by a >>.
This:
Should become:>>> i = q
PYTHON_PROMPT i = q
but this:
should stay as is>>> i = q >> No!
I've tried:
but it only partially worked.s/(?<!^>>[^>])^>>>(?=[^>]*\n)(?!^>>[^>])/PYTHON_PROMPT/mg;
Also, I'd prefer to avoid $1 if possible, for performance reasons.
Thanks!
janitored by ybiC: Minor format tweaks so that entire node isn't enclosed in <code> tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using a regex to catch interpreters
by ikegami (Patriarch) on Jul 06, 2005 at 06:25 UTC | |
by ikegami (Patriarch) on Jul 06, 2005 at 06:52 UTC | |
|
Re: Using a regex to catch interpreters
by anonymized user 468275 (Curate) on Jul 06, 2005 at 09:11 UTC | |
|
Re: Using a regex to catch interpreters
by magnus (Pilgrim) on Jul 06, 2005 at 09:05 UTC | |
|
Re: Using a regex to catch interpreters
by Anonymous Monk on Jul 06, 2005 at 10:43 UTC | |
by eastcoastcoder (Sexton) on Jul 06, 2005 at 14:53 UTC | |
by ikegami (Patriarch) on Jul 06, 2005 at 18:05 UTC | |
by eastcoastcoder (Sexton) on Jul 06, 2005 at 17:34 UTC | |
by eastcoastcoder (Sexton) on Jul 07, 2005 at 17:30 UTC |