So,

$csv_line =~ /(\d)\t(\d)\t(\d.d{3})\t(\d.d{3})\(\d.d{3})/
looks plausible. Except, '\d' matches a digit. It won't match an alphabetic character. '\w' will match alphanumeric (and '_'), or you can be more precise with [A-Z] type character classes. You don't anchor the start of the regex to the start of the string, so this will happily match to something deep inside the input string, if it doesn't match at the start. (If you do decide to anchor the regex, look out for the space or whatever it is before the first character.) You're matching the rest of the line quite carefully and precisely -- if the numbers are not of the exact form given, you will miss lines. You might want to think about some diagnostic messages for lines that are not matched, so you don't miss stuff without knowing about it.

I couldn't see what the '+' in /SEQ+/ was for. What it will do is match 'SEQ' or 'SEQQ' or 'SEQQQ' etc. Again this is not anchored.


In reply to Re: Regular Expression Problem by gone2015
in thread Regular Expression Problem by Anonymous Monk

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.