On Sat, Apr 11, 2009 at 10:06 PM, Moos Heintzen wrote:
> Mark Tolonen wrote:
>> Your data looks like XML. If it is actually well-formed XML, have you tried
>> ElementTree?
>
> It is XML. I used minidom from xml.dom, and it worked fine, except it
> was ~16 times slower. I'm parsing a ~70mb file,
Mark Tolonen wrote:
> Your data looks like XML. If it is actually well-formed XML, have you tried
> ElementTree?
It is XML. I used minidom from xml.dom, and it worked fine, except it
was ~16 times slower. I'm parsing a ~70mb file, and the difference is
3 minutes to 10 seconds with re's.
I used
On Sat, Apr 11, 2009 at 6:46 PM, Moos Heintzen wrote:
> Hello Tutors!
>
> I was trying to make some groups optional in a regular expression, but
> I couldn't do it.
>
> For example, I have the string:
>
data = "42 sdlfks d f60 sdf sdf
Title"
>
> and the pattern:
pattern =
"(
"Moos Heintzen" wrote in message
news:7b13ba330904111546n21d90202i7572a75c55b02...@mail.gmail.com...
> Hello Tutors!
>
> I was trying to make some groups optional in a regular expression, but
> I couldn't do it.
>
> For example, I have the string:
>
data = "42 sdlfks d f60 sdf sdf
Tit
Hello Tutors!
I was trying to make some groups optional in a regular expression, but
I couldn't do it.
For example, I have the string:
>>> data = "42 sdlfks d f60 sdf sdf
>>> Title"
and the pattern:
>>> pattern = "(.*?).*?(.*?).*?(.*?)"
This works when all the groups are present.
>>> re.sea