count number of words using regex