Validate text using a while loop

Validate text using a while loop