I have never looked at a PDB before but I am referring http://www.wwpdb.org/documentation/format32/sect9.html for it. Also assuming (from the above write ups) that you are looking to exclude lines with '\sH\s\s' (when it starts with ATOM) and '\sHOH' (when it starts with HETATM).
It can be done with following 2 regexs
/ATOM .{6} H / /HETATM.{6} HOH/
or it can be joined in as shown below
use strict; while (<DATA>) { my $data = $_; print $data if ($data !~ /(?:ATOM .{6} H )|(?:HETATM.{6} HOH)/); } __DATA__ ATOM 601 H LEU A 75 -17.070 -16.002 2.409 1.00 55.63 + N ATOM 602 CA LEU A 75 -16.343 -16.746 3.444 1.00 55.50 + C ATOM 603 C LEU A 75 -16.499 -18.263 3.300 1.00 55.55 + C ATOM 604 H LEU A 75 -16.645 -18.789 2.195 1.00 55.50 + O ATOM 605 CB LEU A 75 -16.776 -16.283 4.844 1.00 55.51 + C TER 606 LEU A 75 ATOM 1185 O LEU B 75 26.292 -4.310 16.940 1.00 55.45 + O ATOM 1186 CB LEU B 75 23.881 -1.551 16.797 1.00 55.32 + C TER 1187 LEU B 75 + HETATM 1188 HOH SRT A1076 -17.263 11.260 28.634 1.00 59.62 + H HETATM 1189 HA SRT A1076 -19.347 11.519 28.341 1.00 59.42 + H HETATM 1190 H3 SRT A1076 -17.157 14.303 28.677 1.00 58.00 + H HETATM 1191 HOH SRT A1076 -15.110 13.610 28.816 1.00 57.77 + H HETATM 1192 O1 SRT A1076 -17.028 11.281 31.131 1.00 62.63 + O ATOM 295 HB2 ALA A 18 4.601 -9.393 7.275 1.00 0.00 + H ATOM 296 HB3 ALA A 18 3.340 -9.147 6.043 1.00 0.00 + H TER 297 ALA A 18
Refer below the output
# Output # ATOM 602 CA LEU A 75 -16.343 -16.746 3.444 1.00 55.50 + C # ATOM 603 C LEU A 75 -16.499 -18.263 3.300 1.00 55.55 + C # ATOM 605 CB LEU A 75 -16.776 -16.283 4.844 1.00 55.51 + C # TER 606 LEU A 75 # ATOM 1185 O LEU B 75 26.292 -4.310 16.940 1.00 55.45 + O # ATOM 1186 CB LEU B 75 23.881 -1.551 16.797 1.00 55.32 + C # TER 1187 LEU B 75 + # HETATM 1189 HA SRT A1076 -19.347 11.519 28.341 1.00 59.42 + H # HETATM 1190 H3 SRT A1076 -17.157 14.303 28.677 1.00 58.00 + H # HETATM 1192 O1 SRT A1076 -17.028 11.281 31.131 1.00 62.63 + O # ATOM 295 HB2 ALA A 18 4.601 -9.393 7.275 1.00 0.00 + H # ATOM 296 HB3 ALA A 18 3.340 -9.147 6.043 1.00 0.00 + H # TER 297 ALA A 18

In reply to Re: Help for a regex problem ? by ashish.kvarma
in thread Help for a regex problem ? by hellworld

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.