Take a look at perlre, you are using wrong the syntax!
\d ## means 1 digit. \d\d ## means 2 digits. \d+ ## means 1 or more digits \d{2,} ## 2 or more \d{3} ## means 3 digits.
And what you are doing just doesn't exists as you think:
\d+{4} ## means one or more digits and the text "{4}".
Actually your REGEXP doesn't compile! I just don't know from where you got the idea of \d+ with {4} after it. And when you use it right you put a lot of \d before it: \d\d\d\d{4}. Note that "\d\d" already means 2 digits, and \d\d\d\d already means what you want (check if the string have only 4 digits) but you put {4} in the last, what means 7 digits!

See perlre, and don't forget that perldoc.com is your friend, so, you can call it every time.

Good luck.

Graciliano M. P.
"Creativity is the expression of the liberty".


In reply to Re: Regular Expression from Hell by gmpassos
in thread Regular Expression from Hell by Anonymous Monk

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.