Well one would hope that "in words" means showing some examples in order to fully describe what is supposed to happen. I really have no idea from the OP's current code this thing is supposed to do. I will add "show some actual examples of match and no match" in future such requests.
Test::More is fine, but something even easier could be fine too. The OP could get his point across by flushing this out with more examples...
use strict;
use warnings;
#wild ass guess
foreach (qw( /HD123FA45
/HD123FA45/anything
anything/HD123FA45
/FC/blah
/LM
/H4p5
asdf/blah/x/H4p9
/asdf7758
))
{
print "$_ ";
if (/\/(H|HD)[0-9]{1,3}(FA|FC|C|P|CO)[0-9]{1,3}$/i or
/\/(FC|LM|CO)/i)
{ print "\t...match!\n"}
else {print "\t...no match!\n";}
}
__END__
/HD123FA45 ...match!
/HD123FA45/anything ...no match!
anything/HD123FA45 ...match!
/FC/blah ...match!
/LM ...match!
/H4p5 ...match!
asdf/blah/x/H4p9 ...match!
/asdf7758 ...no match!
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.