Bloomberg interview question

Write a code to determine if a pattern exists in a string.