in reply to Re^3: Using Look-ahead and Look-behind
in thread Using Look-ahead and Look-behind
I have a dumb question.
This code works well (THANKS Roy!) when looking for DNA string matches within a genome sequence but not when the * is changed to {50,100}
e.g./CCGG # Match starting at DNA sequence CCGG ( (?: (?!CCGG) # make sure we're not finding duplicates mid-stream . # accept any character )*? # any number of times BUT not greedily <==== ) AATT # and ending at AATT /x;
versus
/CCGG ( (?: (?!CCGG) . ){50,100}? # <==== ) AATT # and ending at AATT /x;
This latter one does not have dupes of CCGG but does have dupes of AATT. The previous snippet has no dupes of either CCGG or AATT.
A follow-up: The following code snippet fixes my problem, and I have NO idea why! I tried it out of desperation
/CCGG ( (?: (?!AATT|CCGG) # <============= . # ){50,100}? # Here the "?" is not required but I'm anal ) # AATT # /x;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Using Look-ahead and Look-behind
by choroba (Cardinal) on Oct 15, 2012 at 15:25 UTC | |
Re^5: Using Look-ahead and Look-behind
by Anonymous Monk on Oct 15, 2012 at 15:28 UTC |
In Section
Tutorials