http://qs321.pair.com?node_id=168491


in reply to self limiting regex help

If I understand your conditions correctly, this should do:

print if /^ [ACGT]* ([RYMKSWHBVDN])? (?:[ACGT]|\1)*([RYMKSWHBVDN])? (?:[ACGT]|\1|\2)*$ /ix;