recursive function applied to enable checking for multiple invalid characters