It's difficult to know what should and shouldn't match from your limited examples, especially as I see the opposite to your claim of which matches (even after fixing your typo):
for ( 'A_TAG_HSSL_LBA_1', 'A_TAG_HSSL_LBAB_1' ) {
if( ! /A_[A_Z0-9_]+/i) {
print "$_ is not matching\n";
}
else {
print "$_ matches\n";
}
}
Produces:
A_TAG_HSSL_LBA_1 matches
A_TAG_HSSL_LBAB_1 is not matching
I think the regexp is matching somewhere other than where you think it's matching. A_TAG_HSSL_LBA_1 is matched at A_1, not at the start.
I suspect the regexp you're after is really
/^ # start of string
A_ # must start "A_"
[A-Z0-9_]+ # at least one capital, digit or underscore
$ # end of string
/ix # allow spaces and comments inside regexp
# and ignore case
Or, /^A_[A-z0-9_]+$/i in short. But, since you're ignoring case (which I just noticed), [A-Z0-9_] are just "word" characters, so your regexp reduces to: /^A_\w+$/i
Of course, this is all guesswork, so it could well be all wrong.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.