针对现有的模式匹配算法的不足,在分析了传统的BF、KMP和BM模式匹配算法的基础上,提出了一种改进的模式匹配算法(NBM),该算法的思想是对BM算法中滑动距离函数d ist右移模式距离大小进行改进,并且定义了两个新的滑动距离函数,在不同的条件下,分别调用不同的滑动距离函数,更好的控制模式匹配过程.实验结果表明,该算法比BF、KMP和BM算法显著减少了字符匹配次数,有效地提高了模式匹配的速度.
An improved pattern matching algorithm(NBM) is presented based on analyzing BF,KMP and BM.The idea of NBM algorithm is using different gliding distance functions by modifying the distance of dist function in BM and defining two new gliding distance functions.This algorithm can choose different gliding distances from different cases to control pattern matching process excellently.Experiments show that this NBM algorithm is more efficient,better performance and less time consumption.