I still don't really understand the number range you're trying to isolate (use  <code> tags on anything with  [ ] in it, or else  &#91; &#93; HTML entities), but here's something to maybe get started with:

c:\@Work\Perl\monks>perl -wMstrict -le "my @pinList = map {; qq{pce_rx_n$_}, qq{pce_rx_p$_}, qq{pce_tx_n$_}, qq{pce_tx_p$_}, qq{cwx_tx_n${_}_blah}, qq{cwx_rx_p${_}bleh}, } 0 .. 15; ;; my $pre = qr{ pce | cwx }xms; my $trx = qr{ [tr] x }xms; my $np = qr{ [np] }xms; my $n = qr{ \d (?! \d) }xms; ;; my $ok = qr{ \A $pre _ $trx _ $np $n [_a-z]* \z }xms; ;; for my $p (@pinList) { printf qq{'$p' -> %sok \n}, $p =~ $ok ? '' : 'NOT '; } " 'pce_rx_n0' -> ok 'pce_rx_p0' -> ok 'pce_tx_n0' -> ok 'pce_tx_p0' -> ok 'cwx_tx_n0_blah' -> ok 'cwx_rx_p0bleh' -> ok 'pce_rx_n1' -> ok 'pce_rx_p1' -> ok 'pce_tx_n1' -> ok 'pce_tx_p1' -> ok 'cwx_tx_n1_blah' -> ok 'cwx_rx_p1bleh' -> ok 'pce_rx_n2' -> ok 'pce_rx_p2' -> ok 'pce_tx_n2' -> ok 'pce_tx_p2' -> ok 'cwx_tx_n2_blah' -> ok 'cwx_rx_p2bleh' -> ok 'pce_rx_n3' -> ok 'pce_rx_p3' -> ok 'pce_tx_n3' -> ok 'pce_tx_p3' -> ok 'cwx_tx_n3_blah' -> ok 'cwx_rx_p3bleh' -> ok 'pce_rx_n4' -> ok 'pce_rx_p4' -> ok 'pce_tx_n4' -> ok 'pce_tx_p4' -> ok 'cwx_tx_n4_blah' -> ok 'cwx_rx_p4bleh' -> ok 'pce_rx_n5' -> ok 'pce_rx_p5' -> ok 'pce_tx_n5' -> ok 'pce_tx_p5' -> ok 'cwx_tx_n5_blah' -> ok 'cwx_rx_p5bleh' -> ok 'pce_rx_n6' -> ok 'pce_rx_p6' -> ok 'pce_tx_n6' -> ok 'pce_tx_p6' -> ok 'cwx_tx_n6_blah' -> ok 'cwx_rx_p6bleh' -> ok 'pce_rx_n7' -> ok 'pce_rx_p7' -> ok 'pce_tx_n7' -> ok 'pce_tx_p7' -> ok 'cwx_tx_n7_blah' -> ok 'cwx_rx_p7bleh' -> ok 'pce_rx_n8' -> ok 'pce_rx_p8' -> ok 'pce_tx_n8' -> ok 'pce_tx_p8' -> ok 'cwx_tx_n8_blah' -> ok 'cwx_rx_p8bleh' -> ok 'pce_rx_n9' -> ok 'pce_rx_p9' -> ok 'pce_tx_n9' -> ok 'pce_tx_p9' -> ok 'cwx_tx_n9_blah' -> ok 'cwx_rx_p9bleh' -> ok 'pce_rx_n10' -> NOT ok 'pce_rx_p10' -> NOT ok 'pce_tx_n10' -> NOT ok 'pce_tx_p10' -> NOT ok 'cwx_tx_n10_blah' -> NOT ok 'cwx_rx_p10bleh' -> NOT ok 'pce_rx_n11' -> NOT ok 'pce_rx_p11' -> NOT ok 'pce_tx_n11' -> NOT ok 'pce_tx_p11' -> NOT ok 'cwx_tx_n11_blah' -> NOT ok 'cwx_rx_p11bleh' -> NOT ok 'pce_rx_n12' -> NOT ok 'pce_rx_p12' -> NOT ok 'pce_tx_n12' -> NOT ok 'pce_tx_p12' -> NOT ok 'cwx_tx_n12_blah' -> NOT ok 'cwx_rx_p12bleh' -> NOT ok 'pce_rx_n13' -> NOT ok 'pce_rx_p13' -> NOT ok 'pce_tx_n13' -> NOT ok 'pce_tx_p13' -> NOT ok 'cwx_tx_n13_blah' -> NOT ok 'cwx_rx_p13bleh' -> NOT ok 'pce_rx_n14' -> NOT ok 'pce_rx_p14' -> NOT ok 'pce_tx_n14' -> NOT ok 'pce_tx_p14' -> NOT ok 'cwx_tx_n14_blah' -> NOT ok 'cwx_rx_p14bleh' -> NOT ok 'pce_rx_n15' -> NOT ok 'pce_rx_p15' -> NOT ok 'pce_tx_n15' -> NOT ok 'pce_tx_p15' -> NOT ok 'cwx_tx_n15_blah' -> NOT ok 'cwx_rx_p15bleh' -> NOT ok


Give a man a fish:  <%-{-{-{-<


In reply to Re: regular expression to match specific members of a bus_name by AnomalousMonk
in thread regular expression to match specific members of a bus_name by boleary

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.