Pattern matching is a well-known problem in computer science. Over the years, dozens of exact pattern matching algorithms have been developed. Clearly, search speed is usually the most important aspect, but it is difficult to tell which algorithm is fastest for a specific (given) pattern. Most applications, programming languages, and domain-specific tools maintain a single algorithm for exact pattern matching that may not be the best choice for all use cases. The key finding of this study is that the pattern itself contains information about which algorithm should be used to search for it. We take advantage of this fact to develop a solution that enables faster pattern searching by leveraging machine learning models to select the best-performing algorithm for a given pattern. The selection method uses machine learning models such as Random Forest, Extra Trees, AdaBoost, Bootstrap Aggregation, and Gradient Boosting. The proposed solution is online, i.e., does not require prior reading of the text and is based on the information extracted from the pattern. Experiments show that it is 11% faster than the fastest (on average) exact pattern matching algorithm.