Yes. But you could have answered that question yourself with a short experiment:
use strict; use warnings; while (<DATA>) { if (/^(\d+\D\d)_(LacZ|pgK|SD|SU)(.*)$/) { print "match: $_"; print ' $1', " is $1\n"; print ' $2', " is $2\n"; print ' $3', " is $3\n"; } else { print "no match: $_"; } } __DATA__ 12774L1_LacZ.SEE.rc_C06_2008-12-01.ab1 12774L1_pgK.Neo.2fw_D06_2008-12-01.ab1 12774L1_SD_B06_2008-12-01.ab1 12774L1_SU_A06_2008-12-01.ab1 foo.bar

prints:

match: 12774L1_LacZ.SEE.rc_C06_2008-12-01.ab1 $1 is 12774L1 $2 is LacZ $3 is .SEE.rc_C06_2008-12-01.ab1 match: 12774L1_pgK.Neo.2fw_D06_2008-12-01.ab1 $1 is 12774L1 $2 is pgK $3 is .Neo.2fw_D06_2008-12-01.ab1 match: 12774L1_SD_B06_2008-12-01.ab1 $1 is 12774L1 $2 is SD $3 is _B06_2008-12-01.ab1 match: 12774L1_SU_A06_2008-12-01.ab1 $1 is 12774L1 $2 is SU $3 is _A06_2008-12-01.ab1 no match: foo.bar

Update: Furthermore, grep properly filters out the "foo.bar" file I injected:

use strict; use warnings; use Data::Dumper; my @files = qw( 12774L1_LacZ.SEE.rc_C06_2008-12-01.ab1 12774L1_pgK.Neo.2fw_D06_2008-12-01.ab1 12774L1_SD_B06_2008-12-01.ab1 12774L1_SU_A06_2008-12-01.ab1 foo.bar ); print Dumper(\@files); @files = grep /^(\d+\D\d)_(LacZ|pgK|SD|SU)(.*)$/,@files; print Dumper(\@files); __END__ $VAR1 = [ '12774L1_LacZ.SEE.rc_C06_2008-12-01.ab1', '12774L1_pgK.Neo.2fw_D06_2008-12-01.ab1', '12774L1_SD_B06_2008-12-01.ab1', '12774L1_SU_A06_2008-12-01.ab1', 'foo.bar' ]; $VAR1 = [ '12774L1_LacZ.SEE.rc_C06_2008-12-01.ab1', '12774L1_pgK.Neo.2fw_D06_2008-12-01.ab1', '12774L1_SD_B06_2008-12-01.ab1', '12774L1_SU_A06_2008-12-01.ab1' ];

In reply to Re^3: mv files from dir1 to dir2 by toolic
in thread mv files from dir1 to dir2 by lomSpace

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.