I am trying to do a regex search on 'NNTSY` so that I can get two matches.
- NNTS
- NTSY
When I attempted to match using the pattern ?<NGrlyosylation>N[^P][ST][^P])"
, I am only getting one match, which is NNTS
.
How can I use Regex to match NNTSY
so that two matches can be found?
NOTE: Background info: Rosalind problem can be found here.
Here is my code.
input = "NNTSY";
Regex regex = new Regex("(?<NGrlyosylation>N[^P][ST][^P])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
MatchCollection matches = regex.Matches(input);
foreach (Match match in matches)
{
// Need to add 1 to because match index is 0 based
const int offset = 1;
yield return match.Index + offset;
}