Sentiment analysis, as a branch of unstructured data mining, has interested people greatly. Sentiment analysis based on machine learning method usually considers less sentimental feature extraction. This article presents a method based on machine learning combining with pattern matching for sentiment analysis. We conduct basic sub‐word first, and then designed the keyword extraction strategy. We designed some emotional expression patterns. After the success matching to those patterns, we get emotional features, which are in the form of sequence. For each feature pattern, we calculated the value of emotional tendency, and finally to obtain the emotional tendency of the web comment based on machine‐learning method. The experiment result shows the method can improve the classification performances compared to using regular machine‐learning method.