Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I have a database table containing regular expresions used against strings (sequences of characters to be used in DNA oligo synthesis) as part of a QC process. So far, this has worked great. But now I have a condition that I'm having trouble writing the regex for.

The string is required to contain only alpha characters. Case is not important, and mixed cases are allowed, so the i modifier is used for all match expresions.

So here's the outline of the new condition. Any number of A,T,C and G are always allowed. Some orders may contain symbols representing degenerate possitions however. For example, R may be used to represent a position that can be either A or G. The total list of possible alternate symbols is R,Y,M,K,S,W,H,B,V,D, and N. Although any of them may be used, only a total of two different alternate codes can be used in a given string (mechanical limitation of the synthesis machine).

So, the chalange is to have a single regular expresion that will match a sequence containing any number of A,T,C,G and any number of no more than two different characters from the above alternate codes.

Thanks in advance for whatever wisdom and guidence you can bestow!


In reply to self limiting regex help by spq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-25 09:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found