Telnext interview question

Write a simple algorithm to check if a word matches a pattern