That works wonderfully! Thanks!On 4/20/06, Liam Clarke <[EMAIL PROTECTED]> wrote:
Trick is, to limit them very carefully by specifying what they are to match.Watch .* - I always use .*? myself.For instance, for one of your strings, which ends with the ESC=character>k(some whitespace or not)0
\x1b.*
Regex aside, just for a moment the subject line gets my vote for "Most Succinct Description of Programmer Mindset", if there's a competition on.
Ron
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Argh, Kent's right. In my defense, I've only had one coffee so far.
On 4/21/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
> Liam Clarke wrote:
> > Whereas \x1b\=.k\w*?0 would match it far more precisely, because
> > that's the regex for
> >
> > esc=k0
>
> Slight correction: \w means any 'Word' chara
Liam Clarke wrote:
> Whereas \x1b\=.k\w*?0 would match it far more precisely, because
> that's the regex for
>
> esc=k0
Slight correction: \w means any 'Word' character - alphanumeric plus
underscore. \s matches whiteSpace.
Kent
___
Tutor maillist -
Trick is, to limit them very carefully by specifying what they are to match.
Watch .* - I always use .*? myself.
For instance, for one of your strings, which ends with the ESC=k(some whitespace or not)0
\x1b.*?0 would certainly match that, but it'd also match ESC foo ### # ESC=#k0
Whereas \x1b\=
Yeah, Alan's tutorial is what I used to learn how to code, it's very good.
Regexes are very powerful; which can be a very good thing and a very
bad thing. ;)
Good luck.
On 4/20/06, doug shawhan <[EMAIL PROTECTED]> wrote:
> Got it! Thanks! Mr. Gald hooked me up with his re tutorial as well. Great!
> I cannot for the life of me figure out a pythonic way (read: using the
> split() builtin) to scan for instances of these characters in such and
> such
> order and proximity. I know this is what regex is for,
I'm afraid so, it looks like the time has come to import re.
> I have obtained a copy
Hi Doug,
Best tip ever is your_python_dir\tools\scripts\redemo.py
Interactive regexes. :)
This is pretty good as well - http://www.amk.ca/python/howto/regex/
Good luck,
Liam Clarke
On 4/20/06, doug shawhan <[EMAIL PROTECTED]> wrote:
> I think I'm going to have to suck it up and learn some reg
I think I'm going to have to suck it up and learn some regular expressions.
I have finally gotten my script (using the excellent pyserial module)
to behave. Most of my troubles as enumerated here before were utterly
self-induced. Apparently one cannot watch the execution of one's script
through an