A quick check shows all strings match as you seem to expect. Can you be more specific about what you mean by "doesn't match on a single one"? As Bloodnok has asked, are you really, really sure about your data?

c:\@Work\Perl\monks>perl -wMstrict -le "my @seatlocs = (qw(A1.23BC U2.60L R2.32 C1.3L AB3.45E D45.1A), 'Some +Bldg'); ;; for my $loc (@seatlocs) { print qq{'$loc' }, $loc =~ m{ \b [A-Z]{1} \d{1} \. \d+ [A-Z]* }xms ? 'Correct' : 'Invalid'; } " 'A1.23BC' Correct 'U2.60L' Correct 'R2.32' Correct 'C1.3L' Correct 'AB3.45E' Invalid 'D45.1A' Invalid 'Some Bldg' Invalid

BTW:  [A-Z]{1} is the same as  [A-Z] is the same as  [[:upper:]] and  \d{1} the same as  \d


In reply to Re: Perl will not match my RegEx pattern.... by AnomalousMonk
in thread Perl will not match my RegEx pattern.... by FierceMoose

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.