Fixing an error in the validator of special beginning and ending characters