Thanks for your input. After some more thinking (and info from this thread) I did realize that I was looking at the match the wrong way and that it worked as you have stated here.

Essentially what I am attempting to do is create a date recognition engine. We process about 100,000 files a day with a large variety of naming conventions. Each name contains a date in one format or another. Unfortunately the programs that generate these file do not adhere to one date format or field delimeter.

I plan on adding a little more to it as rules. Such as the file date found can not be in the future, or too far in the past (1923). Since these files are handled many times by many programs the mtime or ctime are not reliable methods for dating the files.

Now that I have this part figured out and that it won't work as I had thought I might start another thread for suggestions on a date recognition engine.

I was able to make this work easily by placing the patterns into an array and then iterating through the array in order of preference and stopping when I reach a suitable fit.


In reply to Re: Re: qr() match order with multiple patterns by gnu@perl
in thread qr() match order with multiple patterns by gnu@perl

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.