Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: string match using with an N in any position

by pvaldes (Chaplain)
on Nov 18, 2011 at 18:10 UTC ( #938894=note: print w/ replies, xml ) Need Help??


in reply to string match using with an N in any position

Just one more, not necessarily better or quicker than the other solutions

if($value =~ m/^(NCGAT|GNGAT|GCNAT|GCGNT|GCGAN|NACGT|CNCGT|CANGT|CACNT|CACGTN).*?$/){do something...}

1. Each of the query strings should be matched only in the beginning of the string 2. The query strings can have an N (and ONLY ONE?) at any position which means for each query string eg. GCGAT we can have NCGAT,GNGAT,GCNAT,GCGNT,GCGAN.


Comment on Re: string match using with an N in any position
Download Code
Re^2: string match using with an N in any position
by hbm (Hermit) on Nov 18, 2011 at 18:26 UTC

    Why the ".*?$"?

      Just a matter of personal preferences. It will helps me to remember what I was doing in future reviews, but you can avoid it if you want (and gain a little speed).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://938894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2014-12-28 16:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls