Week 7
Regular, um, Expressions
A pattern that counts a word, and does not count that word hiding inside a longer word.
A sentence.
A count.
The question, more slowly
The question is: count how many times the word from the spec appears in a sentence, as its own word. The same letters inside a longer word do not count. Punctuation next to the word still counts as the word.
A pattern with word boundaries does that. Searching for the letters alone will count the letters inside another word. Case should not matter, if the spec says so.
People count a word like 'umbrella' because it starts with those letters. Write a sentence that has the word once and also hides it inside a longer word. The count is one.
Before you code
Write a sentence that contains the word once and also contains it inside a longer word. The count should be one. The spec says which word.