String validity check