Trouble with regex
Gerhard Häring
gerhard.haering at gmx.de
Tue Dec 31 11:45:46 EST 2002
* Fernando <iscaris at hotmail.com> [2002-12-31 08:24 -0800]:
> [...]
> #here's the regex
> p = re.compile('<p class=g><a href=([0-9a-zA-Z.:/_-]{1,})')
>
> d = p.search(data)
> d.groups()
> >('http://www.viruete.com/articulos/gauntlet.htm',)
>
> I only get the first one. How can I get all the occurrences of this
> regex?
With .finditer() or .findall().
Gerhard
--
Favourite database: http://www.postgresql.org/
Favourite programming language: http://www.python.org/
Combine the two: http://pypgsql.sf.net/
Embedded database for Python: http://pysqlite.sf.net/
More information about the Python-list
mailing list