re question

Max M. Stalnaker stalnaker at acm.org
Sat Oct 16 15:12:21 EDT 1999


Thank you for the many responses.

I learned about minimalistic searching, which I had not used before and so
did not think to apply to this problem.  This is probably what I thought I
was missing.

I learned that maybe my approach was limited and I should learn to use
htmllib.  Probably the way I am doing it now is only suitable for large
tables of data and should be limited to that.

In the meantime, I used span twice and extracted the string that way.  This
does not require special sentinels either since I can search for the
beginning tag and for the end tag.

Thank you again.




"Max M. Stalnaker" <stalnaker at acm.org> wrote in message
news:T_MN3.7082$E_1.368473 at typ11.nn.bcandid.com...
> I have the following code:
>
>  def subset(self):
>   group=re.search(r"%%%([^%]+)%%%",self.data)
>   self.data=group.groups(0)[0]
>
> Essentially, I get a html page, change some tags to %%% and extract the
> stuff between.  But the way I do it above fails if the stuff between has a
> single %.  The main goal is to extract the stuff.  The changing the tags
is
> just the way I tried and had sometime success.
>
> Maybe there is a better way to do this.  Or someone could perhaps suggest
re
> code that would do it.  Thank you.
>
> My current idea is to construct a single character sentinel out of
something
> greater than chr(128) and use that.  This will probably work in this
> application, but I feel like I am missing something.
>
> --
> Max M. Stalnaker  mailto:stalnaker at acm.org  http://www.astarcc.com
>
>






More information about the Python-list mailing list