in reply to I wan't take undef for an answer
Try matching the physical end of the string using \z: /^([A-G])*\z/;.