The problem with using two regexes is: if it matches and then gets rejected, your pos counter is still incremented. Say you match a string of 6 chars, QGYNNN. What you want from that is QGYNN (right, OP?), but what happens is that all six characters get tossed.
That brings me to a flaw in my proposed solution: it will only give you QGYN from the above input. Needs some tweaking.
Caution: Contents may have been coded under pressure.
Comment on Re^4: Perl regular expression for amino acid sequence