Baidu interview question

How would you implement pattern recognition in strings/text in C++?