This paper proposed a matching algorithm FBMH(Fast Boyer Moor Horspool),which made an improvement on the BMH(Boyer Moor Horspool) and BMHS(Boyer Moor Horspool Sundy) matching algorithm based on the study of several typical pattern matching algorithms used in intrusion detection. The result shows that, the FBMH algorithm has less intrusion detection matching time than BMH and BMHS algorithm. The FBMH algorithm accelerated the speed of pattern matching effectively, therefore enhanced the efficiency of the intrusion detection system.