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

Re: [Tutor] Regular Expression help

2007-06-29 Thread Gardner, Dean
] Sent: 27 June 2007 14:55 To: tutor@python.org; Gardner, Dean Subject: Re: [Tutor] Regular Expression help Gardner, Dean wrote: > Hi > > I have a text file that I would like to split up so that I can use it > in Excel to filter a certain field. However as it is a flat text file > I

Re: [Tutor] Regular Expression help

2007-06-27 Thread Kent Johnson
Gardner, Dean wrote: > Hi > > I have a text file that I would like to split up so that I can use it in > Excel to filter a certain field. However as it is a flat text file I > need to do some processing on it so that Excel can correctly import it. > > File Example: > tag desc

Re: [Tutor] Regular Expression help

2007-06-27 Thread Kent Johnson
Yikes! Sorry about all the duplicate postings. Thunderbird was telling me the send failed so I kept retrying; I guess it was actually sending! Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Regular Expression help

2007-06-27 Thread Kent Johnson
Gardner, Dean wrote: > Hi > > I have a text file that I would like to split up so that I can use it in > Excel to filter a certain field. However as it is a flat text file I > need to do some processing on it so that Excel can correctly import it. > > File Example: > tag desc

Re: [Tutor] Regular Expression help

2007-06-27 Thread Kent Johnson
Gardner, Dean wrote: > Hi > > I have a text file that I would like to split up so that I can use it in > Excel to filter a certain field. However as it is a flat text file I > need to do some processing on it so that Excel can correctly import it. > > File Example: > tag desc

Re: [Tutor] Regular Expression help

2007-06-27 Thread Kent Johnson
Gardner, Dean wrote: > Hi > > I have a text file that I would like to split up so that I can use it in > Excel to filter a certain field. However as it is a flat text file I > need to do some processing on it so that Excel can correctly import it. > > File Example: > tag desc

Re: [Tutor] Regular Expression help

2007-06-27 Thread Kent Johnson
Tom Tucker wrote: > #matchstr regex flow > # (\(\d+,\d+\)) # (0018,0014) > # \s # [space] > # (..*)# Contrast/Bolus Administration Route Sequence > # \s # space > # ([a-z]{2}) # SQ - two letters and no more > # \s # [s

Re: [Tutor] Regular Expression help

2007-06-27 Thread Reed O'Brien
On Jun 27, 2007, at 10:24 AM, Mike Hansen wrote: > > >> -Original Message- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of Gardner, Dean >> Sent: Wednesday, June 27, 2007 3:59 AM >> To: tutor@python.org >> Subject: [Tutor] Regular Expression help >> >> Hi >> >> I have

Re: [Tutor] Regular Expression help

2007-06-27 Thread Mike Hansen
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Gardner, Dean > Sent: Wednesday, June 27, 2007 3:59 AM > To: tutor@python.org > Subject: [Tutor] Regular Expression help > > Hi > > I have a text file that I would like to split up so that I > ca

Re: [Tutor] Regular Expression help

2007-06-27 Thread Mike Hansen
Argh... My e-mail program really messed up the threads. I didn't notice that there was already multiple replies to this message. Doh! Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Regular Expression help

2007-06-27 Thread Kent Johnson
Gardner, Dean wrote: > Hi > > I have a text file that I would like to split up so that I can use it in > Excel to filter a certain field. However as it is a flat text file I > need to do some processing on it so that Excel can correctly import it. > > File Example: > tag desc

Re: [Tutor] Regular Expression help

2007-06-27 Thread Kent Johnson
Gardner, Dean wrote: > Hi > > I have a text file that I would like to split up so that I can use it in > Excel to filter a certain field. However as it is a flat text file I > need to do some processing on it so that Excel can correctly import it. > > File Example: > tag desc

Re: [Tutor] Regular Expression help

2007-06-27 Thread Tom Tucker
I think I have a solution. File (0012,0042) Clinical Trial Subject Reading ID LO 1 (0012,0050) Clinical Trial Time Point ID LO 1 (0012,0051) Clinical Trial Time Point Description ST 1 (0012,0060) Clinical Trial Coordinating Center Name LO 1 (0018,0010) Contrast/Bolus