You could improve the code by deleting all characters except letters and writing the result back to the field before making the test. Is there no limit to the number of letters which the user may enter?