Regular expression problem

Asheesh Laroia pan-news at asheeshenterprises.com
Wed Feb 27 20:44:24 EST 2002


I've been trying to use sgmllib, actually, to delete all the other tags.

It just doesn't handle the <@ [...] > condition well.  It refuses to
parse it, treating it as text.

So, I need to use a regex to kill it, instead.

-- Asheesh.

On Wed, 27 Feb 2002 19:13:25 -0500, Sean 'Shaleh' Perry wrote:


> 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