Regular expression problem

Sean 'Shaleh' Perry shalehperry at attbi.com
Wed Feb 27 19:13:25 EST 2002


On 27-Feb-2002 Asheesh Laroia wrote:
> I have some SGML input (PageMaker 6.5 tagged text), and I want to be able
> to recognize (and delete) a tag.  That tag looks like:
> 
>       <@Trap Body text:>
> 
> It may also look like <@Trap Body text: useless-data>.
> 
> So, I tried the regular expression r"<@.?>".  That doesn't match the
> above string.  Nor does r"<@.?Trap Body text.?>".  What RE should I be
> using, and why doesn't this work?
> 

There is a really nice SGML parser in python's library.  Perhaps it will help
you.  The name is 'sgmllib'.




More information about the Python-list mailing list