The problem you have is that you're misunderstanding quantification of metacharacters, and metacharacters themselves. \w matches one "word" character, not a bunch of characters. \w also does not match "5.0.29.0", for example. Also, '.' matches any character except for newline, so it must be escaped, as in \. if you want it to be seen as a literal character in the pattern match. You probably want something more like this:

m/Rescue21.+patch.+DiffList\.txt/

...or...

{ local $_ = $mystring; if( /Rescue21/ && /patch/ && /DiffList.txt/ ) { #.... } }

...though the latter would give a false positive if the filename looked like "DiffList.txt_patch_Rescue21". In other words, the latter solution wouldn't reject matches where the keywords appeared out of order.


Dave


In reply to Re: Pattern match by davido
in thread Pattern match by JFarr

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.