Re: [Tutor] Regular Expression help - parsing AppleScript Lists as Strings

2007-11-01 Thread Andrew Wu
Ah - thanks for the correction! I missed the extra grouping and the extra spacing ... doh! Sorry about the HTML-formatted e-mail ... Thanks also for the pyparsing variant as well - I didn't know the module existed before! Andrew On 11/1/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > Andrew Wu

Re: [Tutor] Regular Expression help - parsing AppleScript Lists as Strings

2007-11-01 Thread Kent Johnson
Kent Johnson wrote: > You might want to look at doing this with pyparsing, I think it will > make it easier to get the data out vs just recognizing the correct pattern. Here is a pyparsing version that correctly recognizes all of your patterns and returns a (possibly nested) Python list in case

Re: [Tutor] Regular Expression help - parsing AppleScript Lists as Strings

2007-11-01 Thread Kent Johnson
Andrew Wu wrote: >pattern3 = ''' > ^{ > ( > %s > | {%s} # Possible to have 1 level of nested lists > ,?)* # Items are comma-delimited, except for the last item > }$ >''' % (pattern2, pattern2) The above doesn't allow comma after the first instance

[Tutor] Regular Expression help - parsing AppleScript Lists as Strings

2007-10-31 Thread Andrew Wu
Hi, I'm writing utilities to handle return values from AppleScript in python and one of the steps is recognizing when a returned value from an AppleScript execution (via popen and osascript) represents a list (in AppleScript) or not. For the most part I think I have the correct matching pattern,