in reply to Identifying Overlapping Matches in Nucleotide Sequence

You can use the look ahead assertion (found in Extended Patterns), which makes perl search for a pattern and return to the previous position after the match (and /g doesn't allow perl to match exactly at the same position, so it will move by at least one char on the next attempt).

($myseq =~ /(?=AA)/gi ), or (?=(AA)) if you want to capture the matches (which isn't really useful when the pattern is AA).

Replies are listed 'Best First'.
Re^2: Identifying Overlapping Matches in Nucleotide Sequence
by FIJI42 (Acolyte) on Oct 27, 2017 at 13:02 UTC

    This worked perfectly. Thanks!