Haven't tried it, but you could do a 2-tiered grep-approach. Make sure your fasta is not line-wrapped.
grep -o "AA[CT][ACGT]\{3\}\([AU]C[ACGT]|AG[CU]\)" fasta_file | grep -v "[ACGT]\{3\}CC[ACGT][ACGT]\{3\}".
Assuming Asn = AAY = AA[CU], Ser = UCN, AGY = UC[ACGT], AG[CU], Thr = ACN = AC[ACGT], and Pro = CCN = CC[ACGT],
the first part should match all peptides N-X(traditional = all amino acids)-S/T, the second should get rid off the ones that contain proline in the central position. I am not sure about whether you have to use an additional set of \(\) in the first expression.
Doesn't BLAST(P) already support certain redundant characters?
I'm not sure you'll be able to define all of those exactly, since typically
Xmeans any amino acid (I think), without any restriction. You may not be able to find an alphabet that supports all of what you need.You could maybe blast:
NXSandNXT, and then filter the results with a regex to make sure that the next codon is!= *