I have a general question concerning regular expressions generation.
I have a relatively big sequence of 4 letter alphabet ATGC


e.g:
ATCACTGGTTCCTGGACACTACCCTAAACCTTTGAGGA
AATAACCGCTTTGTTGTTGCGATCGCCTAATAAATATC
AGCGTCTTCGTATGATAAACCAATGCGGAAGTACAAAA
TAAAGAGACTGTATTATGTTACT...

I want to generate regular expression according to users query. Per example, I want to search in my sequence for:

"2 CAC and 2 TTT"

"1 A|T CAC" #at least one CAC should be preceded by A or T

"2 C|A TTT T|G #at least two TTT should be preceded by C or A and followed by T or G

and to finish, I want all these matched in a window of 50 letters without taking overlaps into account.

Actually, I need to know if these kind of search are feasible in regex?
Is there any cpan module that can help me do that?

View that I had to make a new search at every user query, I would like to generate a regex satisfying the query and search in my sequences for that

Thanks for any help

In reply to generate regular expression by khoueiry

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.