regex help

Tim Harig usernet at
Wed Jul 8 18:43:41 EDT 2009

On 2009-07-08, Chris Rebert <clp2 at> wrote:
> On Wed, Jul 8, 2009 at 3:06 PM, David<david.bramer at> wrote:
>> I want to extract the open, mkt cap and P/E values - but apart from
>> doing loads of indivdual REs which I think would look messy, I can't
>> think of a better and neater looking way. Any ideas?

You are downloading market data?  Yahoo offers its stats in CSV format that
is easier to parse without a dedicated parser.

> Use an actual HTML parser? Like BeautifulSoup
> (, for instance.

I agree with your sentiment exactly.  If the regex he is trying to get is
difficult enough that he has to ask; then, yes, he should be using a

> I will never understand why so many people try to parse/scrape
> HTML/XML with regexes...

Why?  Because some times it is good enough to get the job done easily.

More information about the Python-list mailing list