[Biopython-dev] removing boiler plate

Andrew Dalke dalke at acm.org
Sun Oct 15 22:52:28 EDT 2000


Cayte:
>  In using Martel, how do we strip boiler plate that may vary from site to
site?
>  Things like user instructions, legends for graphics, etc.

That's going to depend on the boiler plate.  For example, suppose there's
an arbitrary amount of header text which is site specific, followed by
the site independent text.  Suppose also that the transition occurs with
a line containing 5 =s ("=====").

You can use Re(".*\n") to grab all of the header lines, but this will also
grab the "=====\n" line.  Instead, use a negative lookahead assertion to
match all lines except the =s line, as in  Re("(?!=====).*\n").  Of course,
you'll want to get all of those lines, so

header = Rep(Re("(?!=====).*\n"))

The re documentation covers both positive and negative lookaheads.

                    Andrew





More information about the Biopython-dev mailing list