Correcting word count loop using null regex match result