I'm not sure I've fully appreciated all that you've said in this post, it's quite difficult to visualise without real examples of the lines in front of me, but I think that all you need to do is be a little more flexible in what you allow the regex to match.

$target_name = $1 if m[( \d{5,6} ) _at: \d{3} : \d{3} ]x;

The \d{5,6} will allow that part of the regex to match a sequence of either 5 or 6 digits followed by _at:. Will this do wnat you need?

In general, it's usually good practice to only tighten the regex as far as you need to prevent unwanted matches. You might for instance get away with using

$target_name = $1 if m[( \d+ ) _at: \d+ : \d+ ]x;

which would allow for  ... 1_at: 1:1

to . ... 12345678901234567890: 1234567890:1234567890

And all stations in between. Without being able to see a fully representative sample of your data, its difficult to know just how tight you need to make the regex to avoid false matches, but hopefully this will allow you to experiment to make that determination for yourself?

If you find that you are still missing some lines, try adding a prrint statement or two to display the line that was read, and those that were rejected. And post the lines that were falsey rejected along with the regex you are using and it will make it easier for us to help you refine the regex to your needs.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.


In reply to Re: Re: Re: Re: Re: Why is it matching?? by BrowserUk
in thread Why is it matching?? by bioinformatics

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.