re question

Jesse D. Sightler jsight at mindspring.com
Sat Oct 16 01:51:28 EDT 1999


Could you send a better description of the string being searched? 
Perhaps an example URL as well as what you are looking for?  I have
written quite a bit of code for screen-scraping pages, and think that
there has to be a better way than the approach of switching characters
to "%" symbols.  :-)

Usually, the splitting method is the best, but there are definately
plenty of things to try.  Just a little more info... :)

"Max M. Stalnaker" wrote:
> 
> 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

-- 
---------------
Jesse D. Sightler




More information about the Python-list mailing list