Re: [Tutor] Brain In Vice: Why is this so fun to me?

2006-04-21 Thread doug shawhan
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.*

Re: [Tutor] Brain In Vice: Why is this so fun to me?

2006-04-21 Thread Ron Phillips
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

Re: [Tutor] Brain In Vice: Why is this so fun to me?

2006-04-20 Thread Liam Clarke
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

Re: [Tutor] Brain In Vice: Why is this so fun to me?

2006-04-20 Thread Kent Johnson
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 -

Re: [Tutor] Brain In Vice: Why is this so fun to me?

2006-04-20 Thread Liam Clarke
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\=

Re: [Tutor] Brain In Vice: Why is this so fun to me?

2006-04-20 Thread Liam Clarke
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!

Re: [Tutor] Brain In Vice: Why is this so fun to me?

2006-04-19 Thread Alan Gauld
> 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

Re: [Tutor] Brain In Vice: Why is this so fun to me?

2006-04-19 Thread Liam Clarke
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

[Tutor] Brain In Vice: Why is this so fun to me?

2006-04-19 Thread doug shawhan
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