match certain word

Aahz Maruch aahz at panix.com
Fri Sep 29 11:42:30 EDT 2000


In article <mailman.970139383.1640.python-list at python.org>,
irwan <ryzam at tm.net.my> wrote:
>
>how can i use re module to match a word
>
>Ex
>a='<html><title>Test: Data</title></html>'
>
>so i would like only "Test: Data" or any word in with that range return
>back

I'm not sure what you mean by "that range".  It's also not clear what
you want to happen when you do or don't get a match.  Do you want to
retrieve the matching word for later processing?

Because you've got HTML tags, what I recommend is that you look at using
the htmllib module to do the work (instead of an RE), particularly if you
are going to do lots of HTML processing.

BTW, please change your newsreader to post in ASCII (sometimes called
"plain text").  It makes your posts a lot easier to read for many
people; some people will just ignore posts with HTML.
-- 
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

"Perhaps God rewards martyrs, but life seldom does..." --Ulrika O'Brien



More information about the Python-list mailing list