Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

fourth digit should not match digit "2"

by Anonymous Monk
on Aug 06, 2012 at 16:14 UTC ( #985767=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I want to match $folder to M2000AAMFAD2015(match should fail if this digit is "2")7856(fourth digit can be anyother digit other than "2"),there will be digits after this,can somone tell me how can I do that?

if ($HMT =~m/A1234AHTLMR201[^2]\d+/) { }

Replies are listed 'Best First'.
Re: fourth digit should not match digit "2"
by Corion (Pope) on Aug 06, 2012 at 16:17 UTC
Re: fourth digit should not match digit "2"
by CountZero (Bishop) on Aug 06, 2012 at 16:22 UTC


    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://985767]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2018-03-19 02:13 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (231 votes). Check out past polls.