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
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
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
]
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
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
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
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
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
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
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
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
> -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
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
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
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
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
16 matches
Mail list logo