Best way to match everything between tags

John J. Lee phrxy at csv.warwick.ac.uk
Thu Feb 1 00:10:56 EST 2001


On Thu, 1 Feb 2001, Mark Pilgrim wrote:

> In article <DA0e6.94$o3.4354 at news.world-online.no>,
>   "Henning VON ROSEN" <hvrosen at world-online.no> wrote:
> > Hi!
> > I am learning regular expressions.
> >
> > What is thenatural way to match everything that is not "something"
> > fx i want to maipulate all the text of a html document, but none of the tags
>
> Regular expressions may not be the best solution for this.  Try subclassing
> SGMLParser and passing the document through the parser.  Specific class
[...]

The perl FAQ has a useful discussion of this 'how do I match html-ish tags
with regexps' question, IIRC (but it's a long time since I looked at
anything related to perl of course).  The short answer is "don't" as Mark
says.


John




More information about the Python-list mailing list